swagger: add test

This commit is contained in:
André Roth
2024-09-30 23:51:01 +02:00
parent 5b92336668
commit 26a9219f7d
2 changed files with 19 additions and 1 deletions

View File

@@ -33,7 +33,8 @@ class APITest(BaseTest):
"rootDir": f"{os.environ['HOME']}/{BaseTest.aptlyDir}/apiandserve",
"linkMethod": "symlink"
}
}
},
"enableSwaggerEndpoint": True
}
def fixture_available(self):

17
system/t12_api/docs.py Normal file
View File

@@ -0,0 +1,17 @@
from api_lib import APITest
class TaskAPITestSwaggerDocs(APITest):
"""
GET /docs
"""
def check(self):
resp = self.get("/docs/doc.json")
self.check_equal(resp.status_code, 200)
resp = self.get("/docs/", allow_redirects=False)
self.check_equal(resp.status_code, 301)
resp = self.get("/docs/index.html")
self.check_equal(resp.status_code, 200)