Project global variables

This commit is contained in:
ziajka committed 2018-05-04 14:34:44 +02:00
1 parent 80958e8a6d
commit e267f8a8b8
9 files changed
+167 -8

No files matched your search

+22
View File
@@ -251,6 +251,28 @@ def test_create_with_empty_extra_hosts(loop, project, manager):
assert len([ e for e in called_kwargs["data"]["Env"] if "GNS3_EXTRA_HOSTS" in e]) == 0
def test_create_with_project_variables(loop, project_with_variables, manager):
response = {
"Id": "e90e34656806",
"Warnings": []
}
project.variables = [
{"name": "VAR1"},
{"name": "VAR2", "value": "VAL1"}
]
with asyncio_patch("gns3server.compute.docker.Docker.list_images", return_value=[{"image": "ubuntu"}]):
with asyncio_patch("gns3server.compute.docker.Docker.query", return_value=response) as mock:
vm = DockerVM("test", str(uuid.uuid4()), project, manager, "ubuntu")
loop.run_until_complete(asyncio.async(vm.create()))
called_kwargs = mock.call_args[1]
assert "VAR1=" in called_kwargs["data"]["Env"]
assert "VAR2=VAL1" in called_kwargs["data"]["Env"]
assert vm._extra_hosts == extra_hosts
project.variables = None
def test_create_start_cmd(loop, project, manager):
response = {