aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2020-05-05 16:45:34 +0400
committerEgor Kislitsyn <egor@kislitsyn.com>2020-05-05 16:45:34 +0400
commitbabcae7130d3bc75f85adeef1845997cd091eb84 (patch)
treec6a84ae6427795d5b399c0b23588103f64145427 /test
parent8096565653f262844214d715228c31d4ef761f57 (diff)
downloadpleroma-babcae7130d3bc75f85adeef1845997cd091eb84.tar.gz
Move single used schemas to Marker operation schema
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/controllers/marker_controller_test.exs19
1 files changed, 6 insertions, 13 deletions
diff --git a/test/web/mastodon_api/controllers/marker_controller_test.exs b/test/web/mastodon_api/controllers/marker_controller_test.exs
index 1c85ed032..bce719bea 100644
--- a/test/web/mastodon_api/controllers/marker_controller_test.exs
+++ b/test/web/mastodon_api/controllers/marker_controller_test.exs
@@ -4,10 +4,8 @@
defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
use Pleroma.Web.ConnCase
- alias Pleroma.Web.ApiSpec
import Pleroma.Factory
- import OpenApiSpex.TestAssertions
describe "GET /api/v1/markers" do
test "gets markers with correct scopes", %{conn: conn} do
@@ -25,7 +23,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|> assign(:user, user)
|> assign(:token, token)
|> get("/api/v1/markers?timeline[]=notifications")
- |> json_response(200)
+ |> json_response_and_validate_schema(200)
assert response == %{
"notifications" => %{
@@ -34,8 +32,6 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"version" => 0
}
}
-
- assert_schema(response, "MarkersResponse", ApiSpec.spec())
end
test "gets markers with missed scopes", %{conn: conn} do
@@ -49,7 +45,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|> assign(:user, user)
|> assign(:token, token)
|> get("/api/v1/markers", %{timeline: ["notifications"]})
- |> json_response(403)
+ |> json_response_and_validate_schema(403)
assert response == %{"error" => "Insufficient permissions: read:statuses."}
end
@@ -69,7 +65,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
home: %{last_read_id: "777"},
notifications: %{"last_read_id" => "69420"}
})
- |> json_response(200)
+ |> json_response_and_validate_schema(200)
assert %{
"notifications" => %{
@@ -78,8 +74,6 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"version" => 0
}
} = response
-
- assert_schema(response, "MarkersResponse", ApiSpec.spec())
end
test "updates exist marker", %{conn: conn} do
@@ -101,7 +95,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
home: %{last_read_id: "777"},
notifications: %{"last_read_id" => "69888"}
})
- |> json_response(200)
+ |> json_response_and_validate_schema(200)
assert response == %{
"notifications" => %{
@@ -110,8 +104,6 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"version" => 0
}
}
-
- assert_schema(response, "MarkersResponse", ApiSpec.spec())
end
test "creates a marker with missed scopes", %{conn: conn} do
@@ -122,11 +114,12 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
conn
|> assign(:user, user)
|> assign(:token, token)
+ |> put_req_header("content-type", "application/json")
|> post("/api/v1/markers", %{
home: %{last_read_id: "777"},
notifications: %{"last_read_id" => "69420"}
})
- |> json_response(403)
+ |> json_response_and_validate_schema(403)
assert response == %{"error" => "Insufficient permissions: write:statuses."}
end