Skip to content

Commit

Permalink
Adding basic docs endpoint sanity test
Browse files Browse the repository at this point in the history
  • Loading branch information
YiHuangDB committed Dec 28, 2023
1 parent 2088b8c commit 932044e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions demo/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,14 @@ def test_menu_links(url: str):


# TODO tests for forms, including submission

def test_doc():
r = client.get('/docs')
assert r.status_code == 200, r.text
html_content = r.text
title_start = html_content.find("<title>") + len("<title>")
title_end = html_content.find("</title>")
title = html_content[title_start:title_end]
assert title == 'FastAPI - Swagger UI'
assert r.headers.get('content-type') == 'text/html; charset=utf-8'

0 comments on commit 932044e

Please sign in to comment.