예제 #1
0
def test_it_throws_when_versioning_suspended():
    validate_bucket_versioning.cache_clear()
    client = MagicMock()
    client.get_bucket_versioning.return_value = {"Status": "Suspended"}

    with pytest.raises(ValueError) as e:
        validate_bucket_versioning(client, "bucket")

    assert e.value.args[0] == "Bucket bucket does not have versioning enabled"
예제 #2
0
def test_it_throws_when_mfa_delete_enabled():
    validate_bucket_versioning.cache_clear()
    client = MagicMock()
    client.get_bucket_versioning.return_value = {
        "Status": "Enabled",
        "MFADelete": "Enabled",
    }

    with pytest.raises(ValueError) as e:
        validate_bucket_versioning(client, "bucket")

    assert e.value.args[0] == "Bucket bucket has MFA Delete enabled"
예제 #3
0
def test_it_validates_bucket_versioning():
    validate_bucket_versioning.cache_clear()
    client = MagicMock()
    client.get_bucket_versioning.return_value = {"Status": "Enabled"}
    assert validate_bucket_versioning(client, "bucket")