1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ApiSpec.AppOperationTest do
6 use Pleroma.Web.ConnCase, async: true
8 alias Pleroma.Web.ApiSpec
9 alias Pleroma.Web.ApiSpec.Schemas.AppCreateRequest
10 alias Pleroma.Web.ApiSpec.Schemas.AppCreateResponse
12 import OpenApiSpex.TestAssertions
13 import Pleroma.Factory
15 test "AppCreateRequest example matches schema" do
16 api_spec = ApiSpec.spec()
17 schema = AppCreateRequest.schema()
18 assert_schema(schema.example, "AppCreateRequest", api_spec)
21 test "AppCreateResponse example matches schema" do
22 api_spec = ApiSpec.spec()
23 schema = AppCreateResponse.schema()
24 assert_schema(schema.example, "AppCreateResponse", api_spec)
27 test "AppController produces a AppCreateResponse", %{conn: conn} do
28 api_spec = ApiSpec.spec()
29 app_attrs = build(:oauth_app)
33 |> put_req_header("content-type", "application/json")
37 client_name: app_attrs.client_name,
38 redirect_uris: app_attrs.redirect_uris
43 assert_schema(json, "AppCreateResponse", api_spec)