diff options
author | lain <lain@soykaf.club> | 2020-06-19 13:42:57 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-19 13:42:57 +0000 |
commit | cafdf18408e9c2a38215ea8de133fcc02c336c6a (patch) | |
tree | 06e0dc0b748e906f20217943e7e6e4f7a328d935 /test | |
parent | 372533b7c3bcd2846cdb8f6cfb0cb748049c76b5 (diff) | |
parent | 5237a2df9f123f661de30a53193b7d9fec69ecae (diff) | |
download | pleroma-cafdf18408e9c2a38215ea8de133fcc02c336c6a.tar.gz pleroma-cafdf18408e9c2a38215ea8de133fcc02c336c6a.zip |
Merge branch '1873-pagination-fixes' into 'develop'
[#1873] :offset pagination param support, hashtags pagination
Closes #1873
See merge request pleroma/pleroma!2659
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/search_controller_test.exs | 16 | ||||
-rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/test/web/mastodon_api/controllers/search_controller_test.exs b/test/web/mastodon_api/controllers/search_controller_test.exs index c605957b1..826f37fbc 100644 --- a/test/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/web/mastodon_api/controllers/search_controller_test.exs @@ -151,6 +151,22 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do ] end + test "supports pagination of hashtags search results", %{conn: conn} do + results = + conn + |> get( + "/api/v2/search?#{ + URI.encode_query(%{q: "#some #text #with #hashtags", limit: 2, offset: 1}) + }" + ) + |> json_response_and_validate_schema(200) + + assert results["hashtags"] == [ + %{"name" => "text", "url" => "#{Web.base_url()}/tag/text"}, + %{"name" => "with", "url" => "#{Web.base_url()}/tag/with"} + ] + end + test "excludes a blocked users from search results", %{conn: conn} do user = insert(:user) user_smith = insert(:user, %{nickname: "Agent", name: "I love 2hu"}) diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index 648e6f2ce..a98e939e8 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -1561,7 +1561,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do # Using the header for pagination works correctly [next, _] = get_resp_header(result, "link") |> hd() |> String.split(", ") - [_, max_id] = Regex.run(~r/max_id=(.*)>;/, next) + [_, max_id] = Regex.run(~r/max_id=([^&]+)/, next) assert max_id == third_favorite.id |