Debian Codegraph @

tests/test_server.py

raw symbols SCIP
1 from ninja import NinjaAPI
2
3
4 class TestServer:
5 def test_server_basic(self):
6 server = {"url": "http://example.com"}
7 api = NinjaAPI(servers=[server])
8 schema = api.get_openapi_schema()
9
10 schema_server = schema["servers"]
11 assert schema_server == [server]
12
13 def test_server_with_description(self):
14 server = {
15 "url": "http://example.com",
16 "description": "this is the example server",
17 }
18 api = NinjaAPI(servers=[server])
19 schema = api.get_openapi_schema()
20
21 schema_server = schema["servers"]
22 assert schema_server == [server]
23
24 def test_multiple_servers_with_description(self):
25 server_1 = {
26 "url": "http://example1.com",
27 "description": "this is the example server 1",
28 }
29 server_2 = {
30 "url": "http://example2.com",
31 "description": "this is the example server 2",
32 }
33 servers = [server_1, server_2]
34 api = NinjaAPI(servers=servers)
35 schema = api.get_openapi_schema()
36
37 schema_server = schema["servers"]
38 assert schema_server == servers