1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-17 22:08:35 +00:00

Fix other issues with tests.

This commit is contained in:
grossmj 2020-06-16 19:03:42 +09:30
parent d9ab29a9e0
commit 9ab8599e1e
2 changed files with 5 additions and 10 deletions

View File

@ -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)

View File

@ -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