Introduce Github Actions to replace TravisCI (#3610)

This commit is contained in:
Bert Blommers 2021-01-26 12:37:03 +00:00 committed by GitHub
commit 8591eda9d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 368 additions and 244 deletions

View file

@ -2523,6 +2523,16 @@ def test_create_open_id_connect_provider():
)
@pytest.mark.parametrize("url", ["example.org", "example"])
@mock_iam
def test_create_open_id_connect_provider_invalid_url(url):
client = boto3.client("iam", region_name="us-east-1")
with pytest.raises(ClientError) as e:
client.create_open_id_connect_provider(Url=url, ThumbprintList=[])
msg = e.value.response["Error"]["Message"]
msg.should.contain("Invalid Open ID Connect Provider URL")
@mock_iam
def test_create_open_id_connect_provider_errors():
client = boto3.client("iam", region_name="us-east-1")
@ -2532,49 +2542,65 @@ def test_create_open_id_connect_provider_errors():
Url="https://example.com", ThumbprintList=[]
).should.throw(ClientError, "Unknown")
client.create_open_id_connect_provider.when.called_with(
Url="example.org", ThumbprintList=[]
).should.throw(ClientError, "Invalid Open ID Connect Provider URL")
client.create_open_id_connect_provider.when.called_with(
Url="example", ThumbprintList=[]
).should.throw(ClientError, "Invalid Open ID Connect Provider URL")
@mock_iam
def test_create_open_id_connect_provider_too_many_entries():
client = boto3.client("iam", region_name="us-east-1")
client.create_open_id_connect_provider.when.called_with(
Url="http://example.org",
ThumbprintList=["a" * 40, "b" * 40, "c" * 40, "d" * 40, "e" * 40, "f" * 40,],
).should.throw(ClientError, "Thumbprint list must contain fewer than 5 entries.")
with pytest.raises(ClientError) as e:
client.create_open_id_connect_provider(
Url="http://example.org",
ThumbprintList=[
"a" * 40,
"b" * 40,
"c" * 40,
"d" * 40,
"e" * 40,
"f" * 40,
],
)
msg = e.value.response["Error"]["Message"]
msg.should.contain("Thumbprint list must contain fewer than 5 entries.")
@mock_iam
def test_create_open_id_connect_provider_quota_error():
client = boto3.client("iam", region_name="us-east-1")
too_many_client_ids = ["{}".format(i) for i in range(101)]
client.create_open_id_connect_provider.when.called_with(
Url="http://example.org", ThumbprintList=[], ClientIDList=too_many_client_ids,
).should.throw(
ClientError, "Cannot exceed quota for ClientIdsPerOpenIdConnectProvider: 100",
)
with pytest.raises(ClientError) as e:
client.create_open_id_connect_provider(
Url="http://example.org",
ThumbprintList=[],
ClientIDList=too_many_client_ids,
)
msg = e.value.response["Error"]["Message"]
msg.should.contain("Cannot exceed quota for ClientIdsPerOpenIdConnectProvider: 100")
@mock_iam
def test_create_open_id_connect_provider_multiple_errors():
client = boto3.client("iam", region_name="us-east-1")
too_long_url = "b" * 256
too_long_thumbprint = "b" * 41
too_long_client_id = "b" * 256
client.create_open_id_connect_provider.when.called_with(
Url=too_long_url,
ThumbprintList=[too_long_thumbprint],
ClientIDList=[too_long_client_id],
).should.throw(
ClientError,
"3 validation errors detected: "
'Value "{0}" at "clientIDList" failed to satisfy constraint: '
"Member must satisfy constraint: "
"[Member must have length less than or equal to 255, "
"Member must have length greater than or equal to 1]; "
'Value "{1}" at "thumbprintList" failed to satisfy constraint: '
"Member must satisfy constraint: "
"[Member must have length less than or equal to 40, "
"Member must have length greater than or equal to 40]; "
'Value "{2}" at "url" failed to satisfy constraint: '
"Member must have length less than or equal to 255".format(
[too_long_client_id], [too_long_thumbprint], too_long_url
),
)
with pytest.raises(ClientError) as e:
client.create_open_id_connect_provider(
Url=too_long_url,
ThumbprintList=[too_long_thumbprint],
ClientIDList=[too_long_client_id],
)
msg = e.value.response["Error"]["Message"]
msg.should.contain("3 validation errors detected:")
msg.should.contain('"clientIDList" failed to satisfy constraint:')
msg.should.contain("Member must have length less than or equal to 255")
msg.should.contain("Member must have length greater than or equal to 1")
msg.should.contain('"thumbprintList" failed to satisfy constraint:')
msg.should.contain("Member must have length less than or equal to 40")
msg.should.contain("Member must have length greater than or equal to 40")
msg.should.contain('"url" failed to satisfy constraint:')
msg.should.contain("Member must have length less than or equal to 255")
@mock_iam