aboutsummaryrefslogtreecommitdiff
path: root/test/web/api_spec/account_operation_test.exs
diff options
context:
space:
mode:
Diffstat (limited to 'test/web/api_spec/account_operation_test.exs')
-rw-r--r--test/web/api_spec/account_operation_test.exs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/web/api_spec/account_operation_test.exs b/test/web/api_spec/account_operation_test.exs
index a54059074..58a38d8af 100644
--- a/test/web/api_spec/account_operation_test.exs
+++ b/test/web/api_spec/account_operation_test.exs
@@ -9,6 +9,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperationTest do
alias Pleroma.Web.ApiSpec.Schemas.Account
alias Pleroma.Web.ApiSpec.Schemas.AccountCreateRequest
alias Pleroma.Web.ApiSpec.Schemas.AccountCreateResponse
+ alias Pleroma.Web.ApiSpec.Schemas.AccountRelationshipsResponse
alias Pleroma.Web.ApiSpec.Schemas.AccountUpdateCredentialsRequest
import OpenApiSpex.TestAssertions
@@ -84,4 +85,27 @@ defmodule Pleroma.Web.ApiSpec.AccountOperationTest do
assert_schema(json, "Account", api_spec)
end
+
+ test "AccountRelationshipsResponse example matches schema" do
+ api_spec = ApiSpec.spec()
+ schema = AccountRelationshipsResponse.schema()
+ assert_schema(schema.example, "AccountRelationshipsResponse", api_spec)
+ end
+
+ test "/api/v1/accounts/relationships produces AccountRelationshipsResponse", %{
+ conn: conn
+ } do
+ token = insert(:oauth_token, scopes: ["read", "write"])
+ other_user = insert(:user)
+ {:ok, _user} = Pleroma.User.follow(token.user, other_user)
+ api_spec = ApiSpec.spec()
+
+ assert [relationship] =
+ conn
+ |> put_req_header("authorization", "Bearer " <> token.token)
+ |> get("/api/v1/accounts/relationships?id=#{other_user.id}")
+ |> json_response(:ok)
+
+ assert_schema([relationship], "AccountRelationshipsResponse", api_spec)
+ end
end