Add test for UI methods
This commit is contained in:
parent
28be71806f
commit
e4a085027b
@ -146,7 +146,7 @@ def clean_ui_subdir(directory: Path):
|
||||
logger.info("Removing UI directory content.")
|
||||
|
||||
for p in reversed(list(directory.glob('**/*'))): # iterate contents from leaves to root
|
||||
if p.name in ('.gitkeep', 'fallback_file.html'):
|
||||
if p.name in ('favicon.ico', 'fallback_file.html'):
|
||||
continue
|
||||
if p.is_file():
|
||||
p.unlink()
|
||||
|
@ -88,6 +88,21 @@ def test_api_not_found(botclient):
|
||||
assert rc.json() == {"detail": "Not Found"}
|
||||
|
||||
|
||||
def test_api_ui_fallback(botclient):
|
||||
ftbot, client = botclient
|
||||
|
||||
rc = client_get(client, "/favicon.ico")
|
||||
assert rc.status_code == 200
|
||||
|
||||
rc = client_get(client, "/fallback_file.html")
|
||||
assert rc.status_code == 200
|
||||
assert '`freqtrade install-ui`' in rc.text
|
||||
|
||||
# Forwarded to fallback_html or index.html (depending if it's installed or not)
|
||||
rc = client_get(client, "/something")
|
||||
assert rc.status_code == 200
|
||||
|
||||
|
||||
def test_api_auth():
|
||||
with pytest.raises(ValueError):
|
||||
create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType")
|
||||
|
Loading…
Reference in New Issue
Block a user