X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fcontrollers%2Fsearch_controller_test.exs;h=e31cd0291fd0e264a8338ded17f77fc0b8dc60bd;hb=7c1d804554cd361753f4d6f2d0ac27a9281c885f;hp=1045ab2653044c8b5d3fc2b221f11611b0a39ab4;hpb=57d0379b89bd323dacf4959b03c55519de173ec0;p=akkoma
diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs
index 1045ab265..e31cd0291 100644
--- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs
@@ -1,13 +1,13 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
use Pleroma.Web.ConnCase
alias Pleroma.Object
- alias Pleroma.Web
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.Endpoint
import Pleroma.Factory
import ExUnit.CaptureLog
import Tesla.Mock
@@ -61,7 +61,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
assert account["id"] == to_string(user_three.id)
assert results["hashtags"] == [
- %{"name" => "private", "url" => "#{Web.base_url()}/tag/private"}
+ %{"name" => "private", "url" => "#{Endpoint.url()}/tag/private"}
]
[status] = results["statuses"]
@@ -72,7 +72,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|> json_response_and_validate_schema(200)
assert results["hashtags"] == [
- %{"name" => "天å", "url" => "#{Web.base_url()}/tag/天å"}
+ %{"name" => "天å", "url" => "#{Endpoint.url()}/tag/天å"}
]
[status] = results["statuses"]
@@ -87,8 +87,8 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|> json_response_and_validate_schema(200)
assert results["hashtags"] == [
- %{"name" => "explicit", "url" => "#{Web.base_url()}/tag/explicit"},
- %{"name" => "hashtags", "url" => "#{Web.base_url()}/tag/hashtags"}
+ %{"name" => "explicit", "url" => "#{Endpoint.url()}/tag/explicit"},
+ %{"name" => "hashtags", "url" => "#{Endpoint.url()}/tag/hashtags"}
]
results =
@@ -97,9 +97,9 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|> json_response_and_validate_schema(200)
assert results["hashtags"] == [
- %{"name" => "john", "url" => "#{Web.base_url()}/tag/john"},
- %{"name" => "doe", "url" => "#{Web.base_url()}/tag/doe"},
- %{"name" => "JohnDoe", "url" => "#{Web.base_url()}/tag/JohnDoe"}
+ %{"name" => "john", "url" => "#{Endpoint.url()}/tag/john"},
+ %{"name" => "doe", "url" => "#{Endpoint.url()}/tag/doe"},
+ %{"name" => "JohnDoe", "url" => "#{Endpoint.url()}/tag/JohnDoe"}
]
results =
@@ -108,9 +108,9 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|> json_response_and_validate_schema(200)
assert results["hashtags"] == [
- %{"name" => "accident", "url" => "#{Web.base_url()}/tag/accident"},
- %{"name" => "prone", "url" => "#{Web.base_url()}/tag/prone"},
- %{"name" => "AccidentProne", "url" => "#{Web.base_url()}/tag/AccidentProne"}
+ %{"name" => "accident", "url" => "#{Endpoint.url()}/tag/accident"},
+ %{"name" => "prone", "url" => "#{Endpoint.url()}/tag/prone"},
+ %{"name" => "AccidentProne", "url" => "#{Endpoint.url()}/tag/AccidentProne"}
]
results =
@@ -119,35 +119,29 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
|> json_response_and_validate_schema(200)
assert results["hashtags"] == [
- %{"name" => "shpuld", "url" => "#{Web.base_url()}/tag/shpuld"}
+ %{"name" => "shpuld", "url" => "#{Endpoint.url()}/tag/shpuld"}
]
results =
conn
|> get(
- "/api/v2/search?#{
- URI.encode_query(%{
- q:
- "https://www.washingtonpost.com/sports/2020/06/10/" <>
- "nascar-ban-display-confederate-flag-all-events-properties/"
- })
- }"
+ "/api/v2/search?#{URI.encode_query(%{q: "https://www.washingtonpost.com/sports/2020/06/10/" <> "nascar-ban-display-confederate-flag-all-events-properties/"})}"
)
|> json_response_and_validate_schema(200)
assert results["hashtags"] == [
- %{"name" => "nascar", "url" => "#{Web.base_url()}/tag/nascar"},
- %{"name" => "ban", "url" => "#{Web.base_url()}/tag/ban"},
- %{"name" => "display", "url" => "#{Web.base_url()}/tag/display"},
- %{"name" => "confederate", "url" => "#{Web.base_url()}/tag/confederate"},
- %{"name" => "flag", "url" => "#{Web.base_url()}/tag/flag"},
- %{"name" => "all", "url" => "#{Web.base_url()}/tag/all"},
- %{"name" => "events", "url" => "#{Web.base_url()}/tag/events"},
- %{"name" => "properties", "url" => "#{Web.base_url()}/tag/properties"},
+ %{"name" => "nascar", "url" => "#{Endpoint.url()}/tag/nascar"},
+ %{"name" => "ban", "url" => "#{Endpoint.url()}/tag/ban"},
+ %{"name" => "display", "url" => "#{Endpoint.url()}/tag/display"},
+ %{"name" => "confederate", "url" => "#{Endpoint.url()}/tag/confederate"},
+ %{"name" => "flag", "url" => "#{Endpoint.url()}/tag/flag"},
+ %{"name" => "all", "url" => "#{Endpoint.url()}/tag/all"},
+ %{"name" => "events", "url" => "#{Endpoint.url()}/tag/events"},
+ %{"name" => "properties", "url" => "#{Endpoint.url()}/tag/properties"},
%{
"name" => "NascarBanDisplayConfederateFlagAllEventsProperties",
"url" =>
- "#{Web.base_url()}/tag/NascarBanDisplayConfederateFlagAllEventsProperties"
+ "#{Endpoint.url()}/tag/NascarBanDisplayConfederateFlagAllEventsProperties"
}
]
end
@@ -156,15 +150,13 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
results =
conn
|> get(
- "/api/v2/search?#{
- URI.encode_query(%{q: "#some #text #with #hashtags", limit: 2, offset: 1})
- }"
+ "/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"}
+ %{"name" => "text", "url" => "#{Endpoint.url()}/tag/text"},
+ %{"name" => "with", "url" => "#{Endpoint.url()}/tag/with"}
]
end
@@ -309,7 +301,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
})
capture_log(fn ->
- q = Object.normalize(activity).data["id"]
+ q = Object.normalize(activity, fetch: false).data["id"]
results =
conn