Merge remote-tracking branch 'origin/asyncio' into asyncio

Conflicts:
	gns3server/modules/project.py
	tests/modules/test_project.py
This commit is contained in:
Jeremy committed 2015-02-04 13:52:46 -07:00
commit b680138073
5 files changed
+67 -9

No files matched your search

+22
View File
@@ -60,6 +60,7 @@ def test_show_project(server):
response = server.post("/projects", query)
assert response.status == 200
response = server.get("/projects/00010203-0405-0607-0809-0a0b0c0d0e0f", example=True)
query["path"] = "/tmp/00010203-0405-0607-0809-0a0b0c0d0e0f"
assert response.json == query
@@ -78,6 +79,27 @@ def test_update_temporary_project(server):
assert response.json["temporary"] is False
def test_update_path_project(server, tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
response = server.post("/projects", {})
assert response.status == 200
query = {"path": str(tmpdir)}
response = server.put("/projects/{project_id}".format(project_id=response.json["project_id"]), query, example=True)
assert response.status == 200
assert response.json["path"] == str(tmpdir)
def test_update_path_project_non_local(server, tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={"local": False}):
response = server.post("/projects", {})
assert response.status == 200
query = {"path": str(tmpdir)}
response = server.put("/projects/{project_id}".format(project_id=response.json["project_id"]), query, example=True)
assert response.status == 403
def test_commit_project(server, project):
with asyncio_patch("gns3server.modules.project.Project.commit", return_value=True) as mock:
response = server.post("/projects/{project_id}/commit".format(project_id=project.id), example=True)
+8 -2
View File
@@ -53,7 +53,6 @@ def test_path(tmpdir):
p = Project(location=str(tmpdir))
assert p.path == os.path.join(str(tmpdir), p.id)
assert os.path.exists(os.path.join(str(tmpdir), p.id))
assert os.path.exists(os.path.join(str(tmpdir), p.id, 'vms'))
assert not os.path.exists(os.path.join(p.path, '.gns3_temporary'))
@@ -77,9 +76,16 @@ def test_changing_location_not_allowed(tmpdir):
p = Project(location=str(tmpdir))
def test_changing_path_not_allowed(tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={"local": False}):
with pytest.raises(aiohttp.web.HTTPForbidden):
p = Project()
p.path = str(tmpdir)
def test_json(tmpdir):
p = Project()
assert p.__json__() == {"location": p.location, "project_id": p.id, "temporary": False}
assert p.__json__() == {"location": p.location, "path": p.path, "project_id": p.id, "temporary": False}
def test_vm_working_directory(tmpdir, vm):