Skip to content

Commit 013d636

Browse files
committed
Added test of adding Specification as a URL.
1 parent f5b2e1e commit 013d636

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Diff for: tests/test_api.py

+36
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,42 @@ def test_api_base_path_slash():
5151
assert api.blueprint.url_prefix == ""
5252

5353

54+
def test_remote_api():
55+
api = FlaskApi(
56+
Specification.load(
57+
"https://raw.githubusercontent.com/spec-first/connexion/165a915/tests/fixtures/simple/swagger.yaml"
58+
),
59+
base_path="/api/v1.0",
60+
)
61+
assert api.blueprint.name == "/api/v1_0"
62+
assert api.blueprint.url_prefix == "/api/v1.0"
63+
64+
api2 = FlaskApi(
65+
Specification.load(
66+
"https://raw.githubusercontent.com/spec-first/connexion/165a915/tests/fixtures/simple/swagger.yaml"
67+
)
68+
)
69+
assert api2.blueprint.name == "/v1_0"
70+
assert api2.blueprint.url_prefix == "/v1.0"
71+
72+
api3 = FlaskApi(
73+
Specification.load(
74+
"https://raw.githubusercontent.com/spec-first/connexion/165a915/tests/fixtures/simple/openapi.yaml"
75+
),
76+
base_path="/api/v1.0",
77+
)
78+
assert api3.blueprint.name == "/api/v1_0"
79+
assert api3.blueprint.url_prefix == "/api/v1.0"
80+
81+
api4 = FlaskApi(
82+
Specification.load(
83+
"https://raw.githubusercontent.com/spec-first/connexion/165a915/tests/fixtures/simple/openapi.yaml"
84+
)
85+
)
86+
assert api4.blueprint.name == "/v1_0"
87+
assert api4.blueprint.url_prefix == "/v1.0"
88+
89+
5490
def test_template():
5591
api1 = FlaskApi(
5692
Specification.load(

0 commit comments

Comments
 (0)