mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Allow user to change project path on local server
This commit is contained in:
1 parent
9f7b8574c8
commit
5a0c224292
5 files changed
+35
-15
No files matched your search
@@ -24,11 +24,11 @@ from unittest.mock import patch
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
|
||||
def test_create_project_with_dir(server, tmpdir):
|
||||
def test_create_project_with_path(server, tmpdir):
|
||||
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
|
||||
response = server.post("/projects", {"location": str(tmpdir)})
|
||||
response = server.post("/projects", {"path": str(tmpdir)})
|
||||
assert response.status == 200
|
||||
assert response.json["location"] == str(tmpdir)
|
||||
assert response.json["path"] == str(tmpdir)
|
||||
|
||||
|
||||
def test_create_project_without_dir(server):
|
||||
@@ -55,13 +55,16 @@ def test_create_project_with_uuid(server):
|
||||
|
||||
|
||||
def test_show_project(server):
|
||||
query = {"project_id": "00010203-0405-0607-0809-0a0b0c0d0e0f", "location": "/tmp", "temporary": False}
|
||||
query = {"project_id": "00010203-0405-0607-0809-0a0b0c0d0e0f", "path": "/tmp", "temporary": False}
|
||||
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
|
||||
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
|
||||
assert len(response.json.keys()) == 4
|
||||
assert len(response.json["location"]) > 0
|
||||
assert response.json["project_id"] == "00010203-0405-0607-0809-0a0b0c0d0e0f"
|
||||
assert response.json["path"] == "/tmp"
|
||||
assert response.json["temporary"] is False
|
||||
|
||||
|
||||
def test_show_project_invalid_uuid(server):
|
||||
|
||||
@@ -56,6 +56,13 @@ def test_path(tmpdir):
|
||||
assert not os.path.exists(os.path.join(p.path, ".gns3_temporary"))
|
||||
|
||||
|
||||
def test_init_path(tmpdir):
|
||||
|
||||
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
|
||||
p = Project(path=str(tmpdir))
|
||||
assert p.path == str(tmpdir)
|
||||
|
||||
|
||||
def test_changing_path_temporary_flag(tmpdir):
|
||||
|
||||
with patch("gns3server.config.Config.get_section_config", return_value={"local": True}):
|
||||
|
||||
Reference in new issue
Block a user