コード例 #1
0
def test_delete_group_failure_timeout_error(
    mocker, identity_client, get_existing_resource_patch
):
    error_message = "Group deletion failed due to timeout"
    additional_properties = dict(
        {"state": "absent", "force": "no", "compartment_id": "compartment_id"}
    )
    get_existing_resource_patch.return_value = create_group_object()
    identity_client.delete_group.side_effect = MaximumWaitTimeExceeded(
        400, "GroupNotEmpty", dict(), error_message
    )
    try:
        oci_group.delete_group(identity_client, get_module(additional_properties))
    except Exception as ex:
        assert error_message in ex.args[0]
コード例 #2
0
def test_delete_group_failure_no_force(
    mocker, identity_client, get_existing_resource_patch
):
    error_message = "The Group is not empty so can not be remoed"
    additional_properties = dict(
        {"state": "absent", "force": "no", "compartment_id": "compartment_id"}
    )
    get_existing_resource_patch.return_value = create_group_object()
    identity_client.delete_group.side_effect = ServiceError(
        400, "GroupNotEmpty", dict(), error_message
    )
    try:
        oci_group.delete_group(identity_client, get_module(additional_properties))
    except Exception as ex:
        assert error_message in ex.args[0]
コード例 #3
0
def test_delete_group_success_no_force(
    mocker, identity_client, get_existing_resource_patch
):
    additional_properties = dict(
        {"state": "absent", "force": "no", "compartment_id": "compartment_id"}
    )
    get_existing_resource_patch.return_value = create_group_object()
    identity_client.delete_group.return_value = None
    result = oci_group.delete_group(identity_client, get_module(additional_properties))
    assert result["changed"] is True
コード例 #4
0
def test_delete_group_success_no_force(mocker, identity_client,
                                       get_existing_resource_patch):
    additional_properties = dict({
        'state': 'absent',
        'force': 'no',
        'compartment_id': 'compartment_id'
    })
    get_existing_resource_patch.return_value = create_group_object()
    identity_client.delete_group.return_value = None
    result = oci_group.delete_group(identity_client,
                                    get_module(additional_properties))
    assert result['changed'] is True