ACM: Include more info to the list_certificates (#5973)
This commit is contained in:
parent
651722689f
commit
fd66843cf7
@ -130,12 +130,7 @@ class AWSCertificateManagerResponse(BaseResponse):
|
||||
certs = []
|
||||
statuses = self._get_param("CertificateStatuses")
|
||||
for cert_bundle in self.acm_backend.get_certificates_list(statuses):
|
||||
certs.append(
|
||||
{
|
||||
"CertificateArn": cert_bundle.arn,
|
||||
"DomainName": cert_bundle.common_name,
|
||||
}
|
||||
)
|
||||
certs.append(cert_bundle.describe()["Certificate"])
|
||||
|
||||
result = {"CertificateSummaryList": certs}
|
||||
return json.dumps(result)
|
||||
|
@ -14,7 +14,6 @@ from moto import mock_acm, mock_elb, settings
|
||||
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
|
||||
from unittest import SkipTest, mock
|
||||
|
||||
|
||||
RESOURCE_FOLDER = os.path.join(os.path.dirname(__file__), "resources")
|
||||
|
||||
|
||||
@ -94,12 +93,18 @@ def test_list_certificates():
|
||||
issued_arn = _import_cert(client)
|
||||
pending_arn = client.request_certificate(DomainName="google.com")["CertificateArn"]
|
||||
|
||||
moto_arn = {"CertificateArn": issued_arn, "DomainName": SERVER_COMMON_NAME}
|
||||
google_arn = {"CertificateArn": pending_arn, "DomainName": "google.com"}
|
||||
|
||||
certs = client.list_certificates()["CertificateSummaryList"]
|
||||
certs.should.contain(moto_arn)
|
||||
certs.should.contain(google_arn)
|
||||
[c["CertificateArn"] for c in certs].should.contain(issued_arn)
|
||||
[c["CertificateArn"] for c in certs].should.contain(pending_arn)
|
||||
for cert in certs:
|
||||
cert.should.have.key("CertificateArn")
|
||||
cert.should.have.key("DomainName")
|
||||
cert.should.have.key("Status")
|
||||
cert.should.have.key("Type")
|
||||
cert.should.have.key("KeyAlgorithm")
|
||||
cert.should.have.key("RenewalEligibility")
|
||||
cert.should.have.key("NotBefore")
|
||||
cert.should.have.key("NotAfter")
|
||||
|
||||
resp = client.list_certificates(CertificateStatuses=["EXPIRED", "INACTIVE"])
|
||||
len(resp["CertificateSummaryList"]).should.equal(0)
|
||||
@ -107,20 +112,20 @@ def test_list_certificates():
|
||||
certs = client.list_certificates(CertificateStatuses=["PENDING_VALIDATION"])[
|
||||
"CertificateSummaryList"
|
||||
]
|
||||
certs.should.contain(google_arn)
|
||||
certs.shouldnt.contain(moto_arn)
|
||||
[c["CertificateArn"] for c in certs].shouldnt.contain(issued_arn)
|
||||
[c["CertificateArn"] for c in certs].should.contain(pending_arn)
|
||||
|
||||
certs = client.list_certificates(CertificateStatuses=["ISSUED"])[
|
||||
"CertificateSummaryList"
|
||||
]
|
||||
certs.shouldnt.contain(google_arn)
|
||||
certs.should.contain(moto_arn)
|
||||
[c["CertificateArn"] for c in certs].should.contain(issued_arn)
|
||||
[c["CertificateArn"] for c in certs].shouldnt.contain(pending_arn)
|
||||
|
||||
certs = client.list_certificates(
|
||||
CertificateStatuses=["ISSUED", "PENDING_VALIDATION"]
|
||||
)["CertificateSummaryList"]
|
||||
certs.should.contain(google_arn)
|
||||
certs.should.contain(moto_arn)
|
||||
[c["CertificateArn"] for c in certs].should.contain(issued_arn)
|
||||
[c["CertificateArn"] for c in certs].should.contain(pending_arn)
|
||||
|
||||
|
||||
@mock_acm
|
||||
|
Loading…
Reference in New Issue
Block a user