From ed22b24fd5cfa8831ab1cdb95ee4f07d24c4953a Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Wed, 31 Mar 2021 13:18:46 +0100 Subject: [PATCH] Support - Allow describe_cases without any params (#3818) --- moto/support/models.py | 3 ++- tests/test_support/test_support.py | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/moto/support/models.py b/moto/support/models.py index 2002407b5..34aafdc28 100644 --- a/moto/support/models.py +++ b/moto/support/models.py @@ -198,8 +198,9 @@ class SupportBackend(BaseBackend): include_communications, ): cases = [] + requested_case_ids = case_id_list or self.cases.keys() - for case in case_id_list: + for case in requested_case_ids: self.advance_case_status(case) self.advance_case_severity_codes(case) formatted_case = { diff --git a/tests/test_support/test_support.py b/tests/test_support/test_support.py index 88658200a..a5c8d5376 100644 --- a/tests/test_support/test_support.py +++ b/tests/test_support/test_support.py @@ -396,6 +396,33 @@ def test_support_created_case_can_be_described_without_max_results_or_next_token actual_case_id.should.equal(value) +@mock_support +def test_support_created_case_can_be_described_without_params(): + """ + On creating a support request it can be described + """ + + client = boto3.client("support", "us-east-1") + + describe_cases_response = client.describe_cases() + describe_cases_response["cases"].should.equal([]) + + client.create_case( + subject="test_subject", + serviceCode="test_service_code", + severityCode="low", + categoryCode="test_category_code", + communicationBody="test_communication_body", + ccEmailAddresses=["test_email_cc",], + language="test_language", + issueType="test_issue_type", + attachmentSetId="test_attachment_set_id", + ) + + describe_cases_response = client.describe_cases() + describe_cases_response["cases"].should.have.length_of(1) + + @mock_support def test_support_created_case_cc_email_correct(): """