Techdebt: Replace sure with regular assertions in support (#6629)
This commit is contained in:
parent
59d4dc8e12
commit
14f9c3d38a
@ -1,59 +1,46 @@
|
|||||||
import sure # noqa # pylint: disable=unused-import
|
"""Test the different server responses for support."""
|
||||||
|
|
||||||
import moto.server as server
|
import moto.server as server
|
||||||
|
|
||||||
"""
|
|
||||||
Test the different server responses for support
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def test_describe_trusted_advisor_checks_returns_check_names():
|
def test_describe_trusted_advisor_checks_returns_check_names():
|
||||||
"""
|
"""Check that the correct names of checks are returned."""
|
||||||
Check that the correct names of checks are returned
|
|
||||||
"""
|
|
||||||
|
|
||||||
backend = server.create_backend_app("support")
|
backend = server.create_backend_app("support")
|
||||||
test_client = backend.test_client()
|
test_client = backend.test_client()
|
||||||
|
|
||||||
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
||||||
|
|
||||||
res.data.should.contain(b"Low Utilization Amazon EC2 Instances")
|
assert b"Low Utilization Amazon EC2 Instances" in res.data
|
||||||
res.data.should.contain(b"ELB Application Load Balancers")
|
assert b"ELB Application Load Balancers" in res.data
|
||||||
|
|
||||||
|
|
||||||
def test_describe_trusted_advisor_checks_does_not_return_wrong_check_names():
|
def test_describe_trusted_advisor_checks_does_not_return_wrong_check_names():
|
||||||
"""
|
"""Check that the wrong names of checks are not returned."""
|
||||||
Check that the wrong names of checks are not returned
|
|
||||||
"""
|
|
||||||
|
|
||||||
backend = server.create_backend_app("support")
|
backend = server.create_backend_app("support")
|
||||||
test_client = backend.test_client()
|
test_client = backend.test_client()
|
||||||
|
|
||||||
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
||||||
|
|
||||||
res.data.doesnot.contain(b"Low Utilization Amazon Foo Instances")
|
assert b"Low Utilization Amazon Foo Instances" not in res.data
|
||||||
res.data.doesnot.contain(b"ELB Application Bar Balancers")
|
assert b"ELB Application Bar Balancers" not in res.data
|
||||||
|
|
||||||
|
|
||||||
def test_describe_trusted_advisor_checks_returns_check_ids():
|
def test_describe_trusted_advisor_checks_returns_check_ids():
|
||||||
"""
|
"""Check that some random ids of checks are returned."""
|
||||||
Check that some random ids of checks are returned
|
|
||||||
"""
|
|
||||||
backend = server.create_backend_app("support")
|
backend = server.create_backend_app("support")
|
||||||
test_client = backend.test_client()
|
test_client = backend.test_client()
|
||||||
|
|
||||||
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
||||||
res.data.should.contain(b"DAvU99Dc4C")
|
assert b"DAvU99Dc4C" in res.data
|
||||||
res.data.should.contain(b"zXCkfM1nI3")
|
assert b"zXCkfM1nI3" in res.data
|
||||||
|
|
||||||
|
|
||||||
def test_describe_trusted_advisor_checks_does_not_return_wrong_id():
|
def test_describe_trusted_advisor_checks_does_not_return_wrong_id():
|
||||||
"""
|
"""Check that some wrong ids of checks are not returned."""
|
||||||
Check that some wrong ids of checks are not returned
|
|
||||||
"""
|
|
||||||
backend = server.create_backend_app("support")
|
backend = server.create_backend_app("support")
|
||||||
test_client = backend.test_client()
|
test_client = backend.test_client()
|
||||||
|
|
||||||
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
res = test_client.get("/?Action=DescribeTrustedAdvisorChecks&Version=2015-12-01")
|
||||||
res.data.doesnot.contain(b"DAvU99DcBAR")
|
assert b"DAvU99DcBAR" not in res.data
|
||||||
res.data.doesnot.contain(b"zXCkfM1nFOO")
|
assert b"zXCkfM1nFOO" not in res.data
|
||||||
|
@ -1,72 +1,59 @@
|
|||||||
import boto3
|
import boto3
|
||||||
import pytest
|
import pytest
|
||||||
import sure # noqa # pylint: disable=unused-import
|
|
||||||
from moto import mock_support
|
from moto import mock_support
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_describe_trusted_advisor_checks_returns_amount_of_checks():
|
def test_describe_trusted_advisor_checks_returns_amount_of_checks():
|
||||||
"""
|
"""Test that trusted advisor returns 104 checks."""
|
||||||
test that the 104 checks that are listed under trusted advisor currently
|
|
||||||
are returned
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
response = client.describe_trusted_advisor_checks(language="en")
|
response = client.describe_trusted_advisor_checks(language="en")
|
||||||
|
assert len(response["checks"]) == 104
|
||||||
response["checks"].should.be.length_of(104)
|
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_describe_trusted_advisor_checks_returns_an_expected_id():
|
def test_describe_trusted_advisor_checks_returns_an_expected_id():
|
||||||
"""
|
"""Test that a random check id is returned."""
|
||||||
test that a random check id is returned
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
response = client.describe_trusted_advisor_checks(language="en")
|
response = client.describe_trusted_advisor_checks(language="en")
|
||||||
check_ids = []
|
check_ids = []
|
||||||
for check in response["checks"]:
|
for check in response["checks"]:
|
||||||
check_ids.append(check["id"])
|
check_ids.append(check["id"])
|
||||||
|
|
||||||
check_ids.should.contain("zXCkfM1nI3")
|
assert "zXCkfM1nI3" in check_ids
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_describe_trusted_advisor_checks_returns_an_expected_check_name():
|
def test_describe_trusted_advisor_checks_returns_an_expected_check_name():
|
||||||
"""
|
"""Test that a random check name is returned."""
|
||||||
test that a random check name is returned
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
response = client.describe_trusted_advisor_checks(language="en")
|
response = client.describe_trusted_advisor_checks(language="en")
|
||||||
check_names = []
|
check_names = []
|
||||||
for check in response["checks"]:
|
for check in response["checks"]:
|
||||||
check_names.append(check["name"])
|
check_names.append(check["name"])
|
||||||
|
|
||||||
check_names.should.contain("Unassociated Elastic IP Addresses")
|
assert "Unassociated Elastic IP Addresses" in check_names
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_refresh_trusted_advisor_check_returns_expected_check():
|
def test_refresh_trusted_advisor_check_returns_expected_check():
|
||||||
"""
|
"""Test refresh of a trusted advisor check returns check id in response."""
|
||||||
A refresh of a trusted advisor check returns the check id
|
|
||||||
in the response
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
check_name = "XXXIIIY"
|
check_name = "XXXIIIY"
|
||||||
response = client.refresh_trusted_advisor_check(checkId=check_name)
|
response = client.refresh_trusted_advisor_check(checkId=check_name)
|
||||||
response["status"]["checkId"].should.equal(check_name)
|
assert response["status"]["checkId"] == check_name
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_refresh_trusted_advisor_check_returns_an_expected_status():
|
def test_refresh_trusted_advisor_check_returns_an_expected_status():
|
||||||
"""
|
"""Test refresh of a trusted advisor check returns an expected status."""
|
||||||
A refresh of a trusted advisor check returns an expected status
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
possible_statuses = ["none", "enqueued", "processing", "success", "abandoned"]
|
possible_statuses = ["none", "enqueued", "processing", "success", "abandoned"]
|
||||||
check_name = "XXXIIIY"
|
check_name = "XXXIIIY"
|
||||||
response = client.refresh_trusted_advisor_check(checkId=check_name)
|
response = client.refresh_trusted_advisor_check(checkId=check_name)
|
||||||
actual_status = response["status"]["status"]
|
actual_status = response["status"]["status"]
|
||||||
possible_statuses.should.contain(actual_status)
|
assert actual_status in possible_statuses
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -80,9 +67,7 @@ def test_refresh_trusted_advisor_check_returns_an_expected_status():
|
|||||||
def test_refresh_trusted_advisor_check_cycles_to_new_status_on_each_call(
|
def test_refresh_trusted_advisor_check_cycles_to_new_status_on_each_call(
|
||||||
possible_statuses,
|
possible_statuses,
|
||||||
):
|
):
|
||||||
"""
|
"""Test when check is called 3 times, 3 expected statuses are returned."""
|
||||||
Called only three times, only three expected statuses are returned
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
check_name = "XXXIIIY"
|
check_name = "XXXIIIY"
|
||||||
actual_statuses = []
|
actual_statuses = []
|
||||||
@ -91,14 +76,12 @@ def test_refresh_trusted_advisor_check_cycles_to_new_status_on_each_call(
|
|||||||
response = client.refresh_trusted_advisor_check(checkId=check_name)
|
response = client.refresh_trusted_advisor_check(checkId=check_name)
|
||||||
actual_statuses.append(response["status"]["status"])
|
actual_statuses.append(response["status"]["status"])
|
||||||
|
|
||||||
actual_statuses.should.equal(possible_statuses)
|
assert actual_statuses == possible_statuses
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_refresh_trusted_advisor_check_cycles_to_new_status_on_with_two_checks():
|
def test_refresh_trusted_advisor_check_cycles_to_new_status_on_with_two_checks():
|
||||||
"""
|
"""Test next expected status is returned when additional checks are made."""
|
||||||
On each call, the next expected status is returned when additional checks are made
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
check_1_name = "XXXIIIY"
|
check_1_name = "XXXIIIY"
|
||||||
check_2_name = "XXXIIIZ"
|
check_2_name = "XXXIIIZ"
|
||||||
@ -120,17 +103,14 @@ def test_refresh_trusted_advisor_check_cycles_to_new_status_on_with_two_checks()
|
|||||||
response = client.refresh_trusted_advisor_check(checkId=check_2_name)
|
response = client.refresh_trusted_advisor_check(checkId=check_2_name)
|
||||||
check_2_statuses.append(response["status"]["status"])
|
check_2_statuses.append(response["status"]["status"])
|
||||||
|
|
||||||
check_1_statuses.should.equal(possible_statuses) and check_2_statuses.should.equal(
|
assert (
|
||||||
possible_statuses
|
check_1_statuses == possible_statuses and check_2_statuses == possible_statuses
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_refresh_trusted_advisor_check_cycle_continues_on_full_cycle():
|
def test_refresh_trusted_advisor_check_cycle_continues_on_full_cycle():
|
||||||
"""
|
"""Test that after cycling through all statuses, check continues cycle."""
|
||||||
After cycling through all statuses, the check continues the cycle
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
check_name = "XXXIIIY"
|
check_name = "XXXIIIY"
|
||||||
possible_statuses = [
|
possible_statuses = [
|
||||||
@ -146,14 +126,12 @@ def test_refresh_trusted_advisor_check_cycle_continues_on_full_cycle():
|
|||||||
|
|
||||||
expected_none_response = client.refresh_trusted_advisor_check(checkId=check_name)
|
expected_none_response = client.refresh_trusted_advisor_check(checkId=check_name)
|
||||||
|
|
||||||
expected_none_response["status"]["status"].should.equal("none")
|
assert expected_none_response["status"]["status"] == "none"
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_case_is_closed():
|
def test_support_case_is_closed():
|
||||||
"""
|
"""Test that on closing a case, the correct response is returned."""
|
||||||
On closing a case, the correct resolved response is returned
|
|
||||||
"""
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -181,17 +159,14 @@ def test_support_case_is_closed():
|
|||||||
expected_initial_case = [resolve_case_response["initialCaseStatus"]]
|
expected_initial_case = [resolve_case_response["initialCaseStatus"]]
|
||||||
expected_final_case = "resolved"
|
expected_final_case = "resolved"
|
||||||
|
|
||||||
set(expected_initial_case).issubset(possible_case_status).should.be.true
|
assert set(expected_initial_case).issubset(possible_case_status) is True
|
||||||
|
|
||||||
expected_final_case.should.equal("resolved")
|
assert expected_final_case == "resolved"
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_case_created():
|
def test_support_case_created():
|
||||||
"""
|
"""Test support request creation response contains case ID."""
|
||||||
On creating a support request its response contains a case ID
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -205,7 +180,7 @@ def test_support_case_created():
|
|||||||
attachmentSetId="test_attachment_set_id",
|
attachmentSetId="test_attachment_set_id",
|
||||||
)
|
)
|
||||||
|
|
||||||
len(create_case_response["caseId"]).should.equal(38)
|
assert len(create_case_response["caseId"]) == 38
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -220,9 +195,7 @@ def test_support_case_created():
|
|||||||
)
|
)
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described(key, value):
|
def test_support_created_case_can_be_described(key, value):
|
||||||
"""
|
"""Test support request creation can be described."""
|
||||||
On creating a support request it can be described
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
@ -252,7 +225,7 @@ def test_support_created_case_can_be_described(key, value):
|
|||||||
|
|
||||||
actual_case_id = describe_cases_response["cases"][0][key]
|
actual_case_id = describe_cases_response["cases"][0][key]
|
||||||
|
|
||||||
actual_case_id.should.equal(value)
|
assert actual_case_id == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -267,9 +240,7 @@ def test_support_created_case_can_be_described(key, value):
|
|||||||
)
|
)
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_without_next_token(key, value):
|
def test_support_created_case_can_be_described_without_next_token(key, value):
|
||||||
"""
|
"""Test support request creation can be described without next token."""
|
||||||
On creating a support request it can be described without next token
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
@ -298,7 +269,7 @@ def test_support_created_case_can_be_described_without_next_token(key, value):
|
|||||||
|
|
||||||
actual_case_id = describe_cases_response["cases"][0][key]
|
actual_case_id = describe_cases_response["cases"][0][key]
|
||||||
|
|
||||||
actual_case_id.should.equal(value)
|
assert actual_case_id == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -313,9 +284,7 @@ def test_support_created_case_can_be_described_without_next_token(key, value):
|
|||||||
)
|
)
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_without_max_results(key, value):
|
def test_support_created_case_can_be_described_without_max_results(key, value):
|
||||||
"""
|
"""Test support request creation can be described without max_results."""
|
||||||
On creating a support request it can be described without max_results
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
@ -344,7 +313,7 @@ def test_support_created_case_can_be_described_without_max_results(key, value):
|
|||||||
|
|
||||||
actual_case_id = describe_cases_response["cases"][0][key]
|
actual_case_id = describe_cases_response["cases"][0][key]
|
||||||
|
|
||||||
actual_case_id.should.equal(value)
|
assert actual_case_id == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -361,9 +330,7 @@ def test_support_created_case_can_be_described_without_max_results(key, value):
|
|||||||
def test_support_created_case_can_be_described_without_max_results_or_next_token(
|
def test_support_created_case_can_be_described_without_max_results_or_next_token(
|
||||||
key, value
|
key, value
|
||||||
):
|
):
|
||||||
"""
|
"""Test support request creation can be described without next token."""
|
||||||
On creating a support request it can be described without max_results
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
@ -391,19 +358,17 @@ def test_support_created_case_can_be_described_without_max_results_or_next_token
|
|||||||
|
|
||||||
actual_case_id = describe_cases_response["cases"][0][key]
|
actual_case_id = describe_cases_response["cases"][0][key]
|
||||||
|
|
||||||
actual_case_id.should.equal(value)
|
assert actual_case_id == value
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_without_params():
|
def test_support_created_case_can_be_described_without_params():
|
||||||
"""
|
"""Test support request creation without params can be described."""
|
||||||
On creating a support request it can be described
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
|
|
||||||
describe_cases_response = client.describe_cases()
|
describe_cases_response = client.describe_cases()
|
||||||
describe_cases_response["cases"].should.equal([])
|
assert describe_cases_response["cases"] == []
|
||||||
|
|
||||||
client.create_case(
|
client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -418,15 +383,12 @@ def test_support_created_case_can_be_described_without_params():
|
|||||||
)
|
)
|
||||||
|
|
||||||
describe_cases_response = client.describe_cases()
|
describe_cases_response = client.describe_cases()
|
||||||
describe_cases_response["cases"].should.have.length_of(1)
|
assert len(describe_cases_response["cases"]) == 1
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_cc_email_correct():
|
def test_support_created_case_cc_email_correct():
|
||||||
"""
|
"""Test a support request can be described with correct cc email."""
|
||||||
On creating a support request it can be described with
|
|
||||||
the correct cc email
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
@ -456,16 +418,12 @@ def test_support_created_case_cc_email_correct():
|
|||||||
|
|
||||||
actual_case_id = describe_cases_response["cases"][0]["ccEmailAddresses"][0]
|
actual_case_id = describe_cases_response["cases"][0]["ccEmailAddresses"][0]
|
||||||
|
|
||||||
actual_case_id.should.equal("test_email_cc")
|
assert actual_case_id == "test_email_cc"
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_case_include_resolved_defaults_to_false():
|
def test_support_case_include_resolved_defaults_to_false():
|
||||||
"""
|
"""Test support request description doesn't include resolved cases."""
|
||||||
On creating a support request it can be described and it
|
|
||||||
defaults to not include resolved cases
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -494,16 +452,12 @@ def test_support_case_include_resolved_defaults_to_false():
|
|||||||
)
|
)
|
||||||
actual = describe_cases_response["cases"]
|
actual = describe_cases_response["cases"]
|
||||||
|
|
||||||
actual.should_not.contain(case_id_list)
|
assert case_id_list not in actual
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_case_include_communications_defaults_to_true():
|
def test_support_case_include_communications_defaults_to_true():
|
||||||
"""
|
"""Test support request description includes communications cases."""
|
||||||
On creating a support request it can be described and it
|
|
||||||
defaults to include communcations cases
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -531,15 +485,12 @@ def test_support_case_include_communications_defaults_to_true():
|
|||||||
|
|
||||||
actual = describe_cases_response["cases"][0]
|
actual = describe_cases_response["cases"][0]
|
||||||
|
|
||||||
actual.should.contain("recentCommunications")
|
assert "recentCommunications" in actual
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_multiple_support_created_cases_can_be_described():
|
def test_multiple_support_created_cases_can_be_described():
|
||||||
"""
|
"""Test creation of multiple support requests descriptions."""
|
||||||
On creating multiple support requests they can be described
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response_1 = client.create_case(
|
create_case_response_1 = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -581,17 +532,16 @@ def test_multiple_support_created_cases_can_be_described():
|
|||||||
actual_case_id_1 = describe_cases_response["cases"][0]["caseId"]
|
actual_case_id_1 = describe_cases_response["cases"][0]["caseId"]
|
||||||
actual_case_id_2 = describe_cases_response["cases"][1]["caseId"]
|
actual_case_id_2 = describe_cases_response["cases"][1]["caseId"]
|
||||||
|
|
||||||
actual_case_id_1.should.equal(case_id_list[0])
|
assert actual_case_id_1 == case_id_list[0]
|
||||||
actual_case_id_2.should.equal(case_id_list[1])
|
assert actual_case_id_2 == case_id_list[1]
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_and_contains_communications_when_set_to_true():
|
def test_support_created_case_can_be_described_and_contains_communications_when_set_to_true():
|
||||||
"""
|
"""Test support request description when includeResolvedCases=True.
|
||||||
On creating a support request it can be described and contains comms
|
|
||||||
when includeResolvedCases=True
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
The suport request description should includes comms.
|
||||||
|
"""
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -619,15 +569,12 @@ def test_support_created_case_can_be_described_and_contains_communications_when_
|
|||||||
)
|
)
|
||||||
|
|
||||||
actual_recent_comm = describe_cases_response["cases"][0]
|
actual_recent_comm = describe_cases_response["cases"][0]
|
||||||
actual_recent_comm.should.contain("recentCommunications")
|
assert "recentCommunications" in actual_recent_comm
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_and_does_not_contain_communications_when_false():
|
def test_support_created_case_can_be_described_and_does_not_contain_communications_when_false():
|
||||||
"""
|
"""Test support request creation when includeCommunications=False."""
|
||||||
On creating a support request it does not include
|
|
||||||
comms when includeCommunications=False
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
@ -656,17 +603,12 @@ def test_support_created_case_can_be_described_and_does_not_contain_communicatio
|
|||||||
)
|
)
|
||||||
|
|
||||||
actual_recent_comm = describe_cases_response["cases"][0]
|
actual_recent_comm = describe_cases_response["cases"][0]
|
||||||
|
assert "recentCommunications" not in actual_recent_comm
|
||||||
actual_recent_comm.should_not.contain("recentCommunications")
|
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_and_contains_resolved_cases_when_true():
|
def test_support_created_case_can_be_described_and_contains_resolved_cases_when_true():
|
||||||
"""
|
"""Test support request creation when includeResolvedCases=true."""
|
||||||
On creating a support request it does contain resolved cases when
|
|
||||||
includeResolvedCases=true
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -696,17 +638,12 @@ def test_support_created_case_can_be_described_and_contains_resolved_cases_when_
|
|||||||
)
|
)
|
||||||
|
|
||||||
actual = describe_cases_response["cases"][0]["caseId"]
|
actual = describe_cases_response["cases"][0]["caseId"]
|
||||||
|
assert actual == case_id_list
|
||||||
actual.should.equal(case_id_list)
|
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_and_does_not_contain_resolved_cases_when_false():
|
def test_support_created_case_can_be_described_and_does_not_contain_resolved_cases_when_false():
|
||||||
"""
|
"""Test support request when includeResolvedCases=false."""
|
||||||
On creating a support request it does not contain resolved cases when
|
|
||||||
includeResolvedCases=false
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -736,15 +673,12 @@ def test_support_created_case_can_be_described_and_does_not_contain_resolved_cas
|
|||||||
)
|
)
|
||||||
|
|
||||||
actual = describe_cases_response["cases"]
|
actual = describe_cases_response["cases"]
|
||||||
actual.should_not.contain(case_id_list)
|
assert case_id_list not in actual
|
||||||
|
|
||||||
|
|
||||||
@mock_support
|
@mock_support
|
||||||
def test_support_created_case_can_be_described_and_can_cycle_case_severities():
|
def test_support_created_case_can_be_described_and_can_cycle_case_severities():
|
||||||
"""
|
"""Test support request creation cycles case severities."""
|
||||||
On creating a support request it can be described and cycles case severities
|
|
||||||
"""
|
|
||||||
|
|
||||||
client = boto3.client("support", "us-east-1")
|
client = boto3.client("support", "us-east-1")
|
||||||
create_case_response = client.create_case(
|
create_case_response = client.create_case(
|
||||||
subject="test_subject",
|
subject="test_subject",
|
||||||
@ -774,5 +708,4 @@ def test_support_created_case_can_be_described_and_can_cycle_case_severities():
|
|||||||
)
|
)
|
||||||
|
|
||||||
actual = describe_cases_response["cases"][0]["severityCode"]
|
actual = describe_cases_response["cases"][0]["severityCode"]
|
||||||
|
assert actual == "urgent"
|
||||||
actual.should.equal("urgent")
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user