Fix other issues with tests.

pull/1782/head
grossmj 4 years ago
parent d9ab29a9e0
commit 9ab8599e1e

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import pytest
import sys
from tests.utils import asyncio_patch, AsyncioMagicMock
from gns3server.controller.gns3vm import GNS3VM
@ -65,6 +66,7 @@ async def test_json(loop, controller):
assert vm.__json__() == vm._settings
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not working well on Windows")
async def test_update_settings(loop, controller):
vm = GNS3VM(controller)

@ -60,23 +60,16 @@ async def test_project(http_client, controller):
assert response.status == 200
async def test_web_ui(http_client, tmpdir):
async def test_web_ui(http_client):
with patch('gns3server.utils.get_resource.get_resource') as mock:
mock.return_value = str(tmpdir)
os.makedirs(str(tmpdir / 'web-ui'))
tmpfile = get_static('web-ui/testing.txt')
with open(tmpfile, 'w+') as f:
f.write('world')
response = await http_client.get('/static/web-ui/testing.txt')
assert response.status == 200
response = await http_client.get('/static/web-ui/index.html')
assert response.status == 200
async def test_web_ui_not_found(http_client, tmpdir):
with patch('gns3server.utils.get_resource.get_resource') as mock:
mock.return_value = str(tmpdir)
response = await http_client.get('/static/web-ui/not-found.txt')
# should serve web-ui/index.html
assert response.status == 200

Loading…
Cancel
Save