mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
"Local" command line parameter is only for stopping
a server that has been started by the desktop GUI
This commit is contained in:
1 parent
8975f63e2f
commit
900d4f79ee
18 files changed
+138
-186
No files matched your search
@@ -21,6 +21,7 @@ import uuid
|
||||
import json
|
||||
import zipfile
|
||||
|
||||
from pathlib import Path
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
from gns3server.controller.import_project import import_project, _move_files_to_compute
|
||||
@@ -74,12 +75,13 @@ async def test_import_project(tmpdir, controller):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_import_project_override(tmpdir, controller):
|
||||
async def test_import_project_override(projects_dir, controller):
|
||||
"""
|
||||
In the case of snapshot we will import a project for
|
||||
override the previous keeping the same project id & location
|
||||
"""
|
||||
|
||||
tmpdir = Path(projects_dir)
|
||||
project_id = str(uuid.uuid4())
|
||||
topology = {
|
||||
"project_id": project_id,
|
||||
@@ -523,11 +525,12 @@ async def test_move_files_to_compute(tmpdir):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_import_project_name_and_location(tmpdir, controller):
|
||||
async def test_import_project_name_and_location(projects_dir, controller):
|
||||
"""
|
||||
Import a project with a different location and name
|
||||
"""
|
||||
|
||||
tmpdir = Path(projects_dir)
|
||||
project_id = str(uuid.uuid4())
|
||||
topology = {
|
||||
"project_id": str(uuid.uuid4()),
|
||||
|
||||
@@ -128,18 +128,19 @@ def test_path_exist(tmpdir):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_init_path(tmpdir):
|
||||
async def test_init_path(projects_dir):
|
||||
|
||||
p = Project(path=str(tmpdir), project_id=str(uuid4()), name="Test")
|
||||
assert p.path == str(tmpdir)
|
||||
project_id = str(uuid4())
|
||||
p = Project(project_id=project_id, name="Test")
|
||||
assert p.path == os.path.join(projects_dir, project_id)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_changing_path_with_quote_not_allowed(tmpdir):
|
||||
async def test_changing_path_with_quote_not_allowed(projects_dir):
|
||||
|
||||
with pytest.raises(ControllerForbiddenError):
|
||||
p = Project(project_id=str(uuid4()), name="Test")
|
||||
p.path = str(tmpdir / "project\"53")
|
||||
p.path = os.path.join(projects_dir, "project\"53")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import os
|
||||
import json
|
||||
import pytest
|
||||
|
||||
@@ -171,7 +171,7 @@ def demo_topology():
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_open(controller, tmpdir):
|
||||
async def test_open(controller, projects_dir):
|
||||
|
||||
simple_topology = {
|
||||
"auto_close": True,
|
||||
@@ -192,12 +192,12 @@ async def test_open(controller, tmpdir):
|
||||
"version": "2.0.0"
|
||||
}
|
||||
|
||||
with open(str(tmpdir / "demo.gns3"), "w+") as f:
|
||||
with open(os.path.join(projects_dir, "demo.gns3"), "w+") as f:
|
||||
json.dump(simple_topology, f)
|
||||
|
||||
project = Project(name="demo",
|
||||
project_id="64ba8408-afbf-4b66-9cdd-1fd854427478",
|
||||
path=str(tmpdir),
|
||||
path=str(projects_dir),
|
||||
controller=controller,
|
||||
filename="demo.gns3",
|
||||
status="closed")
|
||||
|
||||
Reference in new issue
Block a user