aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2019-09-23 22:37:30 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2019-09-23 22:37:30 +0300
commit494bb6bac64361860db194aed57618450a76177d (patch)
tree1fed3fe3d2002745d0a4ddde6ab5390e533d1fd5 /test
parent179fa32dd5d7b4cf1b338fc3df4840ae33525606 (diff)
downloadpleroma-494bb6bac64361860db194aed57618450a76177d.tar.gz
updated tests
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs39
1 files changed, 26 insertions, 13 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 46e74fc75..14cd71aa8 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -2798,6 +2798,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
%{user: user}
end
+ test "returns empty result when rich_media disabled", %{conn: conn, user: user} do
+ Config.put([:rich_media, :enabled], false)
+ {:ok, activity} = CommonAPI.post(user, %{"status" => "https://example.com/ogp"})
+
+ response =
+ conn
+ |> get("/api/v1/statuses/#{activity.id}/card")
+ |> json_response(200)
+
+ assert response == nil
+ end
+
test "returns rich-media card", %{conn: conn, user: user} do
{:ok, activity} = CommonAPI.post(user, %{"status" => "https://example.com/ogp"})
@@ -2869,22 +2881,23 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
}
end
- test "returns empty object when id invalid", %{conn: conn} do
- response =
- conn
- |> get("/api/v1/statuses/9eoozpwTul5mjSEDRI/card")
- |> json_response(200)
-
- assert response == %{}
+ test "returns 404 response when id invalid", %{conn: conn} do
+ assert %{"error" => "Record not found"} =
+ conn
+ |> get("/api/v1/statuses/9eoozpwTul5mjSEDRI/card")
+ |> json_response(404)
end
- test "returns empty object when id isn't FlakeID", %{conn: conn} do
- response =
- conn
- |> get("/api/v1/statuses/3ebbadd1-eb14-4e20-8118/card")
- |> json_response(200)
+ test "returns 404 response when id isn't FlakeID", %{conn: conn} do
+ assert %{"error" => "Record not found"} =
+ conn
+ |> get("/api/v1/statuses/3ebbadd1-eb14-4e20-8118/card")
+ |> json_response(404)
- assert response == %{}
+ assert %{"error" => "Record not found"} =
+ conn
+ |> get("/api/v1/statuses/8118/card")
+ |> json_response(404)
end
end