Fix StatusController test by using the get_query_parameter/2 helper to reliably retrieve the max_id value
This commit is contained in:
parent
8bd8ee03c2
commit
ad363c62c3
|
@ -12,6 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
||||||
alias Pleroma.Object
|
alias Pleroma.Object
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.ScheduledActivity
|
alias Pleroma.ScheduledActivity
|
||||||
|
alias Pleroma.Tests.Helpers
|
||||||
alias Pleroma.Tests.ObanHelpers
|
alias Pleroma.Tests.ObanHelpers
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
|
@ -2191,7 +2192,10 @@ test "favorites paginate correctly" do
|
||||||
|
|
||||||
# Using the header for pagination works correctly
|
# Using the header for pagination works correctly
|
||||||
[next, _] = get_resp_header(result, "link") |> hd() |> String.split(", ")
|
[next, _] = get_resp_header(result, "link") |> hd() |> String.split(", ")
|
||||||
[_, max_id] = Regex.run(~r/max_id=([^&]+)>.*/, next)
|
[next_url, _next_rel] = String.split(next, ";")
|
||||||
|
next_url = String.trim_trailing(next_url, ">") |> String.trim_leading("<")
|
||||||
|
|
||||||
|
max_id = Helpers.get_query_parameter(next_url, "max_id")
|
||||||
|
|
||||||
assert max_id == third_favorite.id
|
assert max_id == third_favorite.id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue