def project(): from gns3.project import Project project = Project() project.setId(str(uuid.uuid4())) project._created = True project.setName("unsaved") return project
def test_project_get_on_created_project(controller): """ Test a get on a remote servers. The project is already created on the server """ uuid = uuid4() project = Project() project._created = True project.setId(uuid) project.get("/test", lambda: 0) mock = controller._http_client.createHTTPQuery args, kwargs = mock.call_args assert args[0] == "GET" assert args[1] == "/projects/{uuid}/test".format(uuid=uuid)
def test_project_put_on_created_project(controller): """ Test a put on a remote servers. The project is already created on the server """ uuid = uuid4() project = Project() project._created = True project.setId(uuid) project.put("/test", lambda: 0, body={"test": "test"}) mock = controller._http_client.createHTTPQuery args, kwargs = mock.call_args assert args[0] == "PUT" assert args[1] == "/projects/{uuid}/test".format(uuid=uuid) assert kwargs["body"] == {"test": "test"}