def test_create_router_existing(self): self.fake_client.networks.list_routers.return_value = {"routers": [self.fake_object]} self.useFixture(mockpatch.PatchObject(javelin, "client_for_user", return_value=self.fake_client)) javelin.create_routers([self.fake_object]) mocked_function = self.fake_client.networks.create_router self.assertFalse(mocked_function.called)
def test_create_router(self): self.fake_client.networks.list_routers.return_value = {"routers": []} self.useFixture(mockpatch.PatchObject(javelin, "client_for_user", return_value=self.fake_client)) javelin.create_routers([self.fake_object]) mocked_function = self.fake_client.networks.create_router mocked_function.assert_called_once_with(self.fake_object["name"])
def test_create_router_existing(self): self.fake_client.networks.list_routers.return_value = { 'routers': [self.fake_object]} self.useFixture(mockpatch.PatchObject(javelin, "client_for_user", return_value=self.fake_client)) javelin.create_routers([self.fake_object]) mocked_function = self.fake_client.networks.create_router self.assertFalse(mocked_function.called)
def test_create_router(self): self.fake_client.networks.list_routers.return_value = {'routers': []} self.useFixture(mockpatch.PatchObject(javelin, "client_for_user", return_value=self.fake_client)) javelin.create_routers([self.fake_object]) mocked_function = self.fake_client.networks.create_router mocked_function.assert_called_once_with(self.fake_object['name'])