summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-09-16 10:42:24 +0200
committerRoger Braun <roger@rogerbraun.net>2017-09-16 10:42:24 +0200
commit9f0a2a714b498edfbacc638fa79e06e3a8dc4d04 (patch)
tree4ccf0183ecea58048bd1a1a3f4e0ac59d4267e5e /test
parentd659fcc1957600e7937af7e9a456af8bc452bbd8 (diff)
downloadpleroma-9f0a2a714b498edfbacc638fa79e06e3a8dc4d04.tar.gz
pleroma-9f0a2a714b498edfbacc638fa79e06e3a8dc4d04.zip
Add basic search.
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 1b887cc24..1bef1a1fd 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -310,4 +310,26 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert [] = json_response(conn, 200)
end)
end
+
+ test "search", %{conn: conn} do
+ user = insert(:user)
+ user_two = insert(:user, %{nickname: "shp@shitposter.club"})
+ user_three = insert(:user, %{nickname: "shp@heldscal.la", name: "I love 2hu"})
+
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "This is about 2hu"})
+ {:ok, _} = CommonAPI.post(user_two, %{"status" => "This isn't"})
+
+ conn = conn
+ |> get("/api/v1/search", %{"q" => "2hu"})
+
+ assert results = json_response(conn, 200)
+
+ [account] = results["accounts"]
+ assert account["id"] == user_three.id
+
+ assert results["hashtags"] == []
+
+ [status] = results["statuses"]
+ assert status["id"] == activity.id
+ end
end