Transform certificates in listener in expected XML (#4049)

This commit is contained in:
Sahil Shah 2021-07-01 11:25:40 -04:00 committed by GitHub
commit 3ae4c23c23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 39 deletions

View file

@ -1767,10 +1767,7 @@ def test_modify_listener_http_to_https():
Port=443,
Protocol="HTTPS",
SslPolicy="ELBSecurityPolicy-TLS-1-2-2017-01",
Certificates=[
{"CertificateArn": google_arn, "IsDefault": False},
{"CertificateArn": yahoo_arn, "IsDefault": True},
],
Certificates=[{"CertificateArn": yahoo_arn,},],
DefaultActions=[{"Type": "forward", "TargetGroupArn": target_group_arn}],
)
response["Listeners"][0]["Port"].should.equal(443)
@ -1778,7 +1775,7 @@ def test_modify_listener_http_to_https():
response["Listeners"][0]["SslPolicy"].should.equal(
"ELBSecurityPolicy-TLS-1-2-2017-01"
)
len(response["Listeners"][0]["Certificates"]).should.equal(2)
len(response["Listeners"][0]["Certificates"]).should.equal(1)
# Check default cert, can't do this in server mode
if os.environ.get("TEST_SERVER_MODE", "false").lower() == "false":
@ -1790,15 +1787,20 @@ def test_modify_listener_http_to_https():
listener.certificate.should.equal(yahoo_arn)
# No default cert
with pytest.raises(ClientError):
with pytest.raises(ClientError) as ex:
client.modify_listener(
ListenerArn=listener_arn,
Port=443,
Protocol="HTTPS",
SslPolicy="ELBSecurityPolicy-TLS-1-2-2017-01",
Certificates=[{"CertificateArn": google_arn, "IsDefault": False}],
Certificates=[],
DefaultActions=[{"Type": "forward", "TargetGroupArn": target_group_arn}],
)
err = ex.value.response["Error"]
err["Code"].should.equal("CertificateWereNotPassed")
err["Message"].should.equal(
"You must provide a list containing exactly one certificate if the listener protocol is HTTPS."
)
# Bad cert
with pytest.raises(ClientError):