Exemplo n.º 1
0
def test_canonical_user():
    identity = f"{uuid.uuid4()}.internal"
    request = Request(
        "Create", identity, {"CanonicalUser": "******"}
    )
    provider.set_request(request, {})
    assert provider.is_valid_request(), provider.reason
Exemplo n.º 2
0
def test_list_of_federated():
    identity = f"{uuid.uuid4()}.internal"
    request = Request(
        "Create", identity, {"Federated": ["ecs.amazonaws.com", "eks.amazonaws.com"]}
    )
    provider.set_request(request, {})
    assert provider.is_valid_request(), provider.reason
Exemplo n.º 3
0
def test_invalid_principal():
    identity = f"{uuid.uuid4()}.internal"
    request = Request(
        "Create",
        identity,
        {"FederatedUser": ["ecs.amazonaws.com", "eks.amazonaws.com"]},
    )
    provider.set_request(request, {})
    assert not provider.is_valid_request(), provider.reason
Exemplo n.º 4
0
def test_list_of_aws_root():
    identity = f"{uuid.uuid4()}.internal"
    request = Request(
        "Create",
        identity,
        {"AWS": ["arn:aws:iam::111111111111:root", "arn:aws:iam::222222222222:root"]},
    )
    provider.set_request(request, {})
    assert provider.is_valid_request(), provider.reason
Exemplo n.º 5
0
def test_wildcard():
    identity = f"{uuid.uuid4()}.internal"
    provider.set_request(Request("Create", identity, "*"), {})
    assert provider.is_valid_request(), provider.reason
Exemplo n.º 6
0
def test_services():
    identity = f"{uuid.uuid4()}.internal"
    request = Request("Create", identity, {"Service": "ecs.amazonaws.com"})
    provider.set_request(request, {})
    assert provider.is_valid_request(), provider.reason
Exemplo n.º 7
0
def test_simple_root():
    identity = f"{uuid.uuid4()}.internal"
    request = Request("Create", identity, {"AWS": "arn:aws:iam::111111111111:root"})
    provider.set_request(request, {})
    assert provider.is_valid_request(), provider.reason