1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 02:08:10 +00:00

Use mocked dir for web-ui redirection test

This commit is contained in:
ziajka 2018-06-26 13:13:19 +02:00
parent 7d75b6248d
commit 41026c74c1

View File

@ -62,9 +62,16 @@ def test_web_ui(http_root, tmpdir):
def test_web_ui_not_found(http_root, tmpdir):
response = http_root.get('/static/web-ui/not-found.txt')
# should serve web-ui/index.html
assert response.status == 200
with patch('gns3server.utils.static.get_static_dir') as mock:
mock.return_value = str(tmpdir)
os.makedirs(str(tmpdir / 'web-ui'))
tmpfile = static.get_static_path('web-ui/index.html')
with open(tmpfile, 'w+') as f:
f.write('world')
response = http_root.get('/static/web-ui/not-found.txt')
# should serve web-ui/index.html
assert response.status == 200
def test_v1(http_root):