diff --git a/zun/tests/unit/api/controllers/v1/test_containers.py b/zun/tests/unit/api/controllers/v1/test_containers.py index 8594eba8f..d7058e027 100644 --- a/zun/tests/unit/api/controllers/v1/test_containers.py +++ b/zun/tests/unit/api/controllers/v1/test_containers.py @@ -178,7 +178,7 @@ class TestContainerController(api_base.FunctionalTest): '"environment": {"key1": "val1", "key2": "val2"}}') self.assertRaises(AppError, self.post, '/v1/containers?run=wrong', params=params, content_type='application/json') - self.assertTrue(mock_container_create.not_called) + self.assertTrue(mock_container_create.assert_not_called) @patch('zun.network.neutron.NeutronAPI.get_available_network') @patch('zun.compute.api.API.container_create') @@ -232,7 +232,7 @@ class TestContainerController(api_base.FunctionalTest): self.post('/v1/containers/', params=params, content_type='application/json') - self.assertTrue(mock_container_create.not_called) + self.assertTrue(mock_container_create.assert_not_called) @patch('zun.network.neutron.NeutronAPI.get_available_network') @patch('zun.compute.api.API.container_create') @@ -639,7 +639,7 @@ class TestContainerController(api_base.FunctionalTest): self.assertEqual( "It is not allowed to create an interface on external network %s" % fake_public_network['id'], response.json['errors'][0]['detail']) - self.assertTrue(mock_container_create.not_called) + self.assertTrue(mock_container_create.assert_not_called) @patch('zun.compute.api.API.container_create') @patch('zun.common.context.RequestContext.can') @@ -787,7 +787,7 @@ class TestContainerController(api_base.FunctionalTest): self.post('/v1/containers/', params=params, content_type='application/json') - self.assertTrue(mock_container_create.not_called) + self.assertTrue(mock_container_create.assert_not_called) mock_neutron_get_network.assert_called_once() @patch('zun.compute.api.API.container_create') @@ -799,7 +799,7 @@ class TestContainerController(api_base.FunctionalTest): '"command": ["env"], "memory": "512"}') self.assertRaises(AppError, self.post, '/v1/containers/', params=params, content_type='application/json') - self.assertTrue(mock_container_create.not_called) + self.assertTrue(mock_container_create.assert_not_called) @patch('zun.objects.Container.list') def test_get_all_containers(self, mock_container_list): @@ -1445,7 +1445,7 @@ class TestContainerController(api_base.FunctionalTest): mock_delete.side_effect = exception.InvalidValue self.assertRaises(AppError, self.delete, '/v1/containers/%s?force=wrong' % test_object.uuid) - self.assertTrue(mock_delete.not_called) + self.assertTrue(mock_delete.assert_not_called) def test_delete_container_with_uuid_not_found(self): uuid = uuidutils.generate_uuid() diff --git a/zun/tests/unit/api/controllers/v1/test_images.py b/zun/tests/unit/api/controllers/v1/test_images.py index b36dceade..dc72690c8 100644 --- a/zun/tests/unit/api/controllers/v1/test_images.py +++ b/zun/tests/unit/api/controllers/v1/test_images.py @@ -58,7 +58,7 @@ class TestImageController(api_base.FunctionalTest): self.post('/v1/images/', params=params, content_type='application/json') - self.assertTrue(mock_image_pull.not_called) + self.assertTrue(mock_image_pull.assert_not_called) @mock.patch('zun.common.policy.enforce', return_value=True) @patch('zun.compute.api.API.image_pull') @@ -77,7 +77,7 @@ class TestImageController(api_base.FunctionalTest): self.assertTrue(mock_image_pull.called) self.assertRaises(AppError, self.post, '/v1/images/', params=params, content_type='application/json') - self.assertTrue(mock_image_pull.not_called) + self.assertTrue(mock_image_pull.assert_not_called) @mock.patch('zun.common.policy.enforce', return_value=True) @patch('zun.compute.api.API.image_pull') diff --git a/zun/tests/unit/pci/test_utils.py b/zun/tests/unit/pci/test_utils.py index cf5378fdf..cf3f35a46 100644 --- a/zun/tests/unit/pci/test_utils.py +++ b/zun/tests/unit/pci/test_utils.py @@ -287,15 +287,15 @@ class GetNetNameByVfPciAddressTestCase(base.TestCase): self.mock_get_ifname.return_value = self.if_name net_name = utils.get_net_name_by_vf_pci_address(self.pci_address) self.assertEqual(ref_net_name, net_name) - self.mock_get_mac.called_once_with(self.pci_address) - self.mock_get_ifname.called_once_with(self.pci_address) + self.mock_get_mac.assert_called_once_with(self.pci_address) + self.mock_get_ifname.assert_called_once_with(self.pci_address) def test_wrong_mac(self): self.mock_get_mac.side_effect = ( exception.PciDeviceNotFoundById(self.pci_address)) net_name = utils.get_net_name_by_vf_pci_address(self.pci_address) self.assertIsNone(net_name) - self.mock_get_mac.called_once_with(self.pci_address) + self.mock_get_mac.assert_called_once_with(self.pci_address) self.mock_get_ifname.assert_not_called() def test_wrong_ifname(self): @@ -304,5 +304,5 @@ class GetNetNameByVfPciAddressTestCase(base.TestCase): exception.PciDeviceNotFoundById(self.pci_address)) net_name = utils.get_net_name_by_vf_pci_address(self.pci_address) self.assertIsNone(net_name) - self.mock_get_mac.called_once_with(self.pci_address) - self.mock_get_ifname.called_once_with(self.pci_address) + self.mock_get_mac.assert_called_once_with(self.pci_address) + self.mock_get_ifname.assert_called_once_with(self.pci_address)