aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2020-04-14 22:50:29 +0400
committerEgor Kislitsyn <egor@kislitsyn.com>2020-05-05 16:44:16 +0400
commit8096565653f262844214d715228c31d4ef761f57 (patch)
tree642a3895dadcc89b36452533b78690497ca55fbc /test
parent33f29760200e00305be20350898ebfd2b3ce21af (diff)
downloadpleroma-8096565653f262844214d715228c31d4ef761f57.tar.gz
Add OpenAPI spec for MarkerController
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/controllers/marker_controller_test.exs12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/web/mastodon_api/controllers/marker_controller_test.exs b/test/web/mastodon_api/controllers/marker_controller_test.exs
index 919f295bd..1c85ed032 100644
--- a/test/web/mastodon_api/controllers/marker_controller_test.exs
+++ b/test/web/mastodon_api/controllers/marker_controller_test.exs
@@ -4,8 +4,10 @@
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
@@ -22,7 +24,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
conn
|> assign(:user, user)
|> assign(:token, token)
- |> get("/api/v1/markers", %{timeline: ["notifications"]})
+ |> get("/api/v1/markers?timeline[]=notifications")
|> json_response(200)
assert response == %{
@@ -32,6 +34,8 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"version" => 0
}
}
+
+ assert_schema(response, "MarkersResponse", ApiSpec.spec())
end
test "gets markers with missed scopes", %{conn: conn} do
@@ -60,6 +64,7 @@ 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"}
@@ -73,6 +78,8 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
"version" => 0
}
} = response
+
+ assert_schema(response, "MarkersResponse", ApiSpec.spec())
end
test "updates exist marker", %{conn: conn} do
@@ -89,6 +96,7 @@ 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" => "69888"}
@@ -102,6 +110,8 @@ 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