diff options
author | lambadalambda <gitgud@rogerbraun.net> | 2017-04-20 10:21:16 -0400 |
---|---|---|
committer | lambadalambda <gitgud@rogerbraun.net> | 2017-04-20 10:21:16 -0400 |
commit | 27c53242a38c68296ebc16551fd0f8eab0d4f000 (patch) | |
tree | 95c553b85a04450165737590159102a719e13086 /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | eda742c78b0087033ee96f27c13dbdc00741cf87 (diff) | |
parent | 3a56d7318fed2b808161c186ba9d7ced73cdf020 (diff) | |
download | pleroma-27c53242a38c68296ebc16551fd0f8eab0d4f000.tar.gz pleroma-27c53242a38c68296ebc16551fd0f8eab0d4f000.zip |
Merge branch 'feature/mentions-timeline' into 'develop'
Add statuses/mentions endpoint
Closes #2
See merge request !10
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 8bf3fe107..e4ed6cd54 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -114,6 +114,27 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end end + describe "GET /statuses/mentions.json" do + setup [:valid_user] + test "without valid credentials", %{conn: conn} do + conn = get conn, "/api/statuses/mentions.json" + assert json_response(conn, 403) == %{"error" => "Invalid credentials."} + end + + test "with credentials", %{conn: conn, user: current_user} do + {:ok, activity} = ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: current_user}) + + conn = conn + |> with_credentials(current_user.nickname, "test") + |> get("/api/statuses/mentions.json") + + response = json_response(conn, 200) + + assert length(response) == 1 + assert Enum.at(response, 0) == ActivityRepresenter.to_map(activity, %{user: current_user, mentioned: [current_user]}) + end + end + describe "GET /statuses/user_timeline.json" do setup [:valid_user] test "without any params", %{conn: conn} do |