From 427705c9f0bee1c938445b41525375d902240264 Mon Sep 17 00:00:00 2001 From: Argishti Rostamian Date: Thu, 19 Oct 2017 14:53:30 -0700 Subject: [PATCH 1/2] check is subject_alt_names is not none before checking length --- moto/acm/responses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moto/acm/responses.py b/moto/acm/responses.py index 7bf12bbb8..431a8cf60 100644 --- a/moto/acm/responses.py +++ b/moto/acm/responses.py @@ -185,7 +185,7 @@ class AWSCertificateManagerResponse(BaseResponse): idempotency_token = self._get_param('IdempotencyToken') subject_alt_names = self._get_param('SubjectAlternativeNames') - if len(subject_alt_names) > 10: + if subject_alt_names is not None and len(subject_alt_names) > 10: # There is initial AWS limit of 10 msg = 'An ACM limit has been exceeded. Need to request SAN limit to be raised' return json.dumps({'__type': 'LimitExceededException', 'message': msg}), dict(status=400) From f02f4646ea8f0c6d7af76258a97afe4535518235 Mon Sep 17 00:00:00 2001 From: Argishti Rostamian Date: Thu, 19 Oct 2017 17:47:21 -0700 Subject: [PATCH 2/2] add test --- tests/test_acm/test_acm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_acm/test_acm.py b/tests/test_acm/test_acm.py index 96e362d1e..db1969645 100644 --- a/tests/test_acm/test_acm.py +++ b/tests/test_acm/test_acm.py @@ -287,6 +287,19 @@ def test_request_certificate(): ) resp.should.contain('CertificateArn') +@mock_acm +def test_request_certificate_no_san(): + client = boto3.client('acm', region_name='eu-central-1') + + resp = client.request_certificate( + DomainName='google.com' + ) + resp.should.contain('CertificateArn') + + resp2 = client.describe_certificate( + CertificateArn=resp['CertificateArn'] + ) + resp2.should.contain('Certificate') # # Also tests the SAN code # # requires Pull: https://github.com/spulec/freezegun/pull/210