summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/mastodon_api_controller_test.exs
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2018-02-11 09:50:55 +0100
committerRoger Braun <roger@rogerbraun.net>2018-02-11 09:50:55 +0100
commit52200998c997576c9008cbe50b0a7b9f0e6134cc (patch)
treec0d68f476442b8dd86fca1e182d5c09553800810 /test/web/mastodon_api/mastodon_api_controller_test.exs
parent4a13b8488787773d09f67d1a436d5906e2f5b171 (diff)
parent0e2ca77eec511857508208d3faeb9217c4496f8a (diff)
downloadpleroma-52200998c997576c9008cbe50b0a7b9f0e6134cc.tar.gz
pleroma-52200998c997576c9008cbe50b0a7b9f0e6134cc.zip
Merge branch 'develop' into feature/activitypub
Diffstat (limited to 'test/web/mastodon_api/mastodon_api_controller_test.exs')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index fc0010569..93b29dfae 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -35,7 +35,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
{:ok, [_activity]} = OStatus.fetch_activity_from_url("https://shitposter.club/notice/2827873")
conn = conn
- |> get("/api/v1/timelines/public")
+ |> get("/api/v1/timelines/public", %{"local" => "False"})
assert length(json_response(conn, 200)) == 2
@@ -43,6 +43,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> get("/api/v1/timelines/public", %{"local" => "True"})
assert [%{"content" => "test"}] = json_response(conn, 200)
+
+ conn = build_conn()
+ |> get("/api/v1/timelines/public", %{"local" => "1"})
+
+ assert [%{"content" => "test"}] = json_response(conn, 200)
end
test "posting a status", %{conn: conn} do
@@ -50,9 +55,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
conn = conn
|> assign(:user, user)
- |> post("/api/v1/statuses", %{"status" => "cofe", "spoiler_text" => "2hu"})
+ |> post("/api/v1/statuses", %{"status" => "cofe", "spoiler_text" => "2hu", "sensitive" => "false"})
- assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu"} = json_response(conn, 200)
+ assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu", "sensitive" => false} = json_response(conn, 200)
assert Repo.get(Activity, id)
end
@@ -145,7 +150,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> get("/api/v1/notifications")
- expected_response = "hi <a href=\"#{user.ap_id}\">@#{user.nickname}</a>"
+ expected_response = "hi <span><a href=\"#{user.ap_id}\">@<span>#{user.nickname}</span></a></span>"
assert [%{"status" => %{"content" => response}} | _rest] = json_response(conn, 200)
assert response == expected_response
end
@@ -161,7 +166,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|> assign(:user, user)
|> get("/api/v1/notifications/#{notification.id}")
- expected_response = "hi <a href=\"#{user.ap_id}\">@#{user.nickname}</a>"
+ expected_response = "hi <span><a href=\"#{user.ap_id}\">@<span>#{user.nickname}</span></a></span>"
assert %{"status" => %{"content" => response}} = json_response(conn, 200)
assert response == expected_response
end
@@ -581,11 +586,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
{:ok, _} = TwitterAPI.create_status(user, %{"status" => "cofe"})
+ Pleroma.Stats.update_stats()
+
conn = conn
|> get("/api/v1/instance")
assert result = json_response(conn, 200)
assert result["stats"]["user_count"] == 2
+ assert result["stats"]["status_count"] == 1
end
end