Skip to content

Commit

Permalink
swagger: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Sep 30, 2024
1 parent 5b92336 commit 26a9219
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion system/api_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class APITest(BaseTest):
"rootDir": f"{os.environ['HOME']}/{BaseTest.aptlyDir}/apiandserve",
"linkMethod": "symlink"
}
}
},
"enableSwaggerEndpoint": True
}

def fixture_available(self):
Expand Down
17 changes: 17 additions & 0 deletions system/t12_api/docs.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 26a9219

Please sign in to comment.