def test_create_or_update_exporte_client_error(file_storage_client, check_and_create_resource_patch): error_message = 'export attribute has no value' module = get_module() check_and_create_resource_patch.side_effect = ClientError( Exception(error_message)) try: oci_export.create_or_update_export(file_storage_client, module) except Exception as ex: assert error_message in ex.args[0]
def test_create_or_update_exporte_service_error(file_storage_client, check_and_create_resource_patch): error_message = 'Internal Server Error' module = get_module() check_and_create_resource_patch.side_effect = ServiceError( 499, 'InternalServerError', dict(), error_message) try: oci_export.create_or_update_export(file_storage_client, module) except Exception as ex: assert error_message in ex.args[0]
def test_create_or_update_export_update(file_storage_client, update_export_patch): module = get_module(dict({'export_id': 'ocid1.export.aaa'})) export = get_export() update_export_patch.return_value = { 'export': to_dict(export), 'changed': True} result = oci_export.create_or_update_export(file_storage_client, module) assert result['export']['lifecycle_state'] is export.lifecycle_state
def test_create_or_update_export_create(file_storage_client, check_and_create_resource_patch): module = get_module() export = get_export() check_and_create_resource_patch.return_value = { 'export': to_dict(export), 'changed': True} result = oci_export.create_or_update_export(file_storage_client, module) assert result['export']['lifecycle_state'] is export.lifecycle_state
def test_create_or_update_export_update(file_storage_client, update_export_patch): module = get_module(dict({"export_id": "ocid1.export.aaa"})) export = get_export() update_export_patch.return_value = { "export": to_dict(export), "changed": True } result = oci_export.create_or_update_export(file_storage_client, module) assert result["export"]["lifecycle_state"] is export.lifecycle_state
def test_create_or_update_export_create(file_storage_client, check_and_create_resource_patch): module = get_module() export = get_export() check_and_create_resource_patch.return_value = { "export": to_dict(export), "changed": True, } result = oci_export.create_or_update_export(file_storage_client, module) assert result["export"]["lifecycle_state"] is export.lifecycle_state