File: test_utils.py

package info (click to toggle)
apispec 6.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 652 kB
  • sloc: python: 4,852; makefile: 150; sh: 10
file content (24 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from apispec import utils


def test_build_reference():
    assert utils.build_reference("schema", 2, "Test") == {"$ref": "#/definitions/Test"}
    assert utils.build_reference("parameter", 2, "Test") == {
        "$ref": "#/parameters/Test"
    }
    assert utils.build_reference("response", 2, "Test") == {"$ref": "#/responses/Test"}
    assert utils.build_reference("security_scheme", 2, "Test") == {
        "$ref": "#/securityDefinitions/Test"
    }
    assert utils.build_reference("schema", 3, "Test") == {
        "$ref": "#/components/schemas/Test"
    }
    assert utils.build_reference("parameter", 3, "Test") == {
        "$ref": "#/components/parameters/Test"
    }
    assert utils.build_reference("response", 3, "Test") == {
        "$ref": "#/components/responses/Test"
    }
    assert utils.build_reference("security_scheme", 3, "Test") == {
        "$ref": "#/components/securitySchemes/Test"
    }