def test_update_database_no_database_for_update(db_client, get_existing_resource_patch): error_message = "No Database" module = get_module( dict({"db_backup_config": { "auto_backup_enabled": True }})) get_existing_resource_patch.return_value = None try: oci_database.update_database(db_client, module) except Exception as ex: assert error_message in str(ex.args)
def test_update_database_service_error(db_client, get_existing_resource_patch, update_and_wait_patch): error_message = "Internal Server Error" database = get_database() module = get_module( dict({"db_backup_config": { "auto_backup_enabled": True }})) get_existing_resource_patch.return_value = database update_and_wait_patch.return_value = ServiceError(499, "InternalServerError", dict(), error_message) try: oci_database.update_database(db_client, module) except Exception as ex: assert error_message in str(ex.args)
def test_update_database_freeform_tags_changed(db_client, get_existing_resource_patch, update_and_wait_patch): module = get_module(dict(freeform_tags=dict(database_type="payroll"))) database = get_database() get_existing_resource_patch.return_value = database update_and_wait_patch.return_value = { "database": to_dict(database), "changed": True, } result = oci_database.update_database(db_client, module) assert result["changed"] is True
def test_update_database_freeform_tags_changed(db_client, get_existing_resource_patch, update_and_wait_patch): module = get_module(dict(freeform_tags=dict(database_type='payroll'))) database = get_database() get_existing_resource_patch.return_value = database update_and_wait_patch.return_value = { 'database': to_dict(database), 'changed': True } result = oci_database.update_database(db_client, module) assert result['changed'] is True
def test_update_database_defined_tags_changed(db_client, get_existing_resource_patch, update_and_wait_patch): module = get_module( dict(defined_tags=dict(usert_type=dict(department="employee")))) database = get_database() get_existing_resource_patch.return_value = database update_and_wait_patch.return_value = { "database": to_dict(database), "changed": True, } result = oci_database.update_database(db_client, module) assert result["changed"] is True
def test_update_database_db_backup_config_changed(db_client, get_existing_resource_patch, update_and_wait_patch): module = get_module( dict({"db_backup_config": { "auto_backup_enabled": True }})) database = get_database() get_existing_resource_patch.return_value = database update_and_wait_patch.return_value = { "database": to_dict(database), "changed": True, } result = oci_database.update_database(db_client, module) assert result["changed"] is True
def test_update_database_no_change(db_client, get_existing_resource_patch): module = get_module(dict()) database = get_database() get_existing_resource_patch.return_value = database result = oci_database.update_database(db_client, module) assert result["changed"] is False