Beispiel #1
0
    def test_successful_remove(self, mock_alert_del, mock_strg_del):
        storage_obj = resources.StorageDeviceTask(
            context, 'c5c91c98-91aa-40e6-85ac-37a1d3b32bda')
        storage_obj.remove()

        mock_strg_del.assert_called_with(
            context, 'c5c91c98-91aa-40e6-85ac-37a1d3b32bda')
        mock_alert_del.assert_called_with(
            context, 'c5c91c98-91aa-40e6-85ac-37a1d3b32bda')
Beispiel #2
0
    def test_sync_successful(self, alert_source_delete, access_info_delete,
                             mock_storage_delete, mock_storage_get,
                             mock_storage_update, mock_get_storage, get_lock):
        storage_obj = resources.StorageDeviceTask(
            context, 'c5c91c98-91aa-40e6-85ac-37a1d3b32bda')

        storage_obj.sync()
        self.assertTrue(get_lock.called)
        self.assertTrue(mock_storage_get.called)
        self.assertTrue(mock_storage_delete.called)
        self.assertTrue(access_info_delete.called)
        self.assertTrue(alert_source_delete.called)
        self.assertTrue(mock_storage_update.called)
        mock_get_storage.assert_called_with(
            context, 'c5c91c98-91aa-40e6-85ac-37a1d3b32bda')

        fake_storage_obj = fake_storage.FakeStorageDriver()
        mock_get_storage.return_value = fake_storage_obj.get_storage(context)
        storage_obj.sync()