1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Fix test on Travis with Python 3.3

This commit is contained in:
Julien Duponchelle 2015-02-13 11:02:06 +01:00
parent 0a5aaedc7c
commit b419001813
2 changed files with 5 additions and 7 deletions

View File

@ -55,15 +55,13 @@ def test_create_project_with_uuid(server):
def test_show_project(server): def test_show_project(server):
query = {"project_id": "00010203-0405-0607-0809-0a0b0c0d0e0f", "path": "/tmp", "temporary": False} query = {"project_id": "00010203-0405-0607-0809-0a0b0c0d0e0f", "temporary": False}
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
response = server.post("/projects", query) response = server.post("/projects", query)
assert response.status == 200 assert response.status == 200
response = server.get("/projects/00010203-0405-0607-0809-0a0b0c0d0e0f", example=True) response = server.get("/projects/00010203-0405-0607-0809-0a0b0c0d0e0f", example=True)
assert len(response.json.keys()) == 4 assert len(response.json.keys()) == 4
assert len(response.json["location"]) > 0 assert len(response.json["location"]) > 0
assert response.json["project_id"] == "00010203-0405-0607-0809-0a0b0c0d0e0f" assert response.json["project_id"] == "00010203-0405-0607-0809-0a0b0c0d0e0f"
assert response.json["path"] == "/tmp"
assert response.json["temporary"] is False assert response.json["temporary"] is False

View File

@ -50,12 +50,12 @@ def test_parse_arguments(capsys):
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
main.parse_arguments(["-v"], server_config) main.parse_arguments(["-v"], server_config)
out, err = capsys.readouterr() out, err = capsys.readouterr()
assert __version__ in err assert __version__ in "{}{}".format(out, err) # Depending of the Python version the location of the version change
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
main.parse_arguments(["--version"], server_config) main.parse_arguments(["--version"], server_config)
out, err = capsys.readouterr() out, err = capsys.readouterr()
assert __version__ in err assert __version__ in "{}{}".format(out, err) # Depending of the Python version the location of the version change
with pytest.raises(SystemExit): with pytest.raises(SystemExit):
main.parse_arguments(["-h"], server_config) main.parse_arguments(["-h"], server_config)