def test_check_prerequisite(self, mock_list_objects): mock_list_objects.return_value = ['obj1'] self.assertEqual( False, swift.Containers(self.creds_manager).check_prerequisite()) mock_list_objects.return_value = [] self.assertEqual( True, swift.Containers(self.creds_manager).check_prerequisite())
def test_delete(self): cont = { 'bytes': 8, 'count': 2, 'last_modified': '2019-06-05T15:20:59.450120', 'name': 'Pouet éêù #' } self.assertIsNone(swift.Containers(self.creds_manager).delete(cont)) self.cloud.delete_container.assert_called_once_with(cont['name'])
def test_disable(self): cont = { 'bytes': 8, 'count': 2, 'last_modified': '2019-06-05T15:20:59.450120', 'name': 'Pouet éêù #' } self.assertIsNone(swift.Containers(self.creds_manager).disable(cont)) self.cloud.object_store.set_container_metadata.assert_called_once_with( cont['name'], read_acl=None, write_acl=None)
def test_to_string(self): container = mock.MagicMock() self.assertIn("Container (", swift.Containers(self.creds_manager).to_str(container))
def test_delete(self): cont = mock.MagicMock() self.assertIsNone(swift.Containers(self.creds_manager).delete(cont)) self.cloud.delete_container.assert_called_once_with(cont['name'])
def test_list(self): self.assertIs(self.cloud.list_containers.return_value, swift.Containers(self.creds_manager).list()) self.cloud.list_containers.assert_called_once_with()