From 75d9082ef427c4c89d72592bf5f18c4d0439cf3b Mon Sep 17 00:00:00 2001 From: kbalk <7536198+kbalk@users.noreply.github.com> Date: Sun, 6 Aug 2023 06:59:41 -0400 Subject: [PATCH] Techdebt: Replace sure with regular assertions in servicequotas (#6604) --- .../test_servicequotas/test_servicequotas.py | 67 +++++++++---------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/tests/test_servicequotas/test_servicequotas.py b/tests/test_servicequotas/test_servicequotas.py index 0380af28a..39570bb66 100644 --- a/tests/test_servicequotas/test_servicequotas.py +++ b/tests/test_servicequotas/test_servicequotas.py @@ -1,9 +1,9 @@ """Unit tests for servicequotas-supported APIs.""" import boto3 -import pytest -import sure # noqa # pylint: disable=unused-import -from moto import mock_servicequotas from botocore.exceptions import ClientError +import pytest + +from moto import mock_servicequotas # See our Development Tips on writing tests for hints on how to write good tests: # http://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.html @@ -14,34 +14,30 @@ def test_list_aws_default_service_quotas(): client = boto3.client("service-quotas", region_name="eu-west-1") resp = client.list_aws_default_service_quotas(ServiceCode="vpc") - resp.should.have.key("Quotas").length_of(25) + assert len(resp["Quotas"]) == 25 - resp["Quotas"].should.contain( - { - "Adjustable": True, - "GlobalQuota": False, - "QuotaArn": "arn:aws:servicequotas:eu-west-1::vpc/L-2AFB9258", - "QuotaCode": "L-2AFB9258", - "QuotaName": "Security groups per network interface", - "ServiceCode": "vpc", - "ServiceName": "Amazon Virtual Private Cloud (Amazon VPC)", - "Unit": "None", - "Value": 5.0, - } - ) - resp["Quotas"].should.contain( - { - "Adjustable": True, - "GlobalQuota": False, - "QuotaArn": "arn:aws:servicequotas:eu-west-1::vpc/L-F678F1CE", - "QuotaCode": "L-F678F1CE", - "QuotaName": "VPCs per Region", - "ServiceCode": "vpc", - "ServiceName": "Amazon Virtual Private Cloud (Amazon VPC)", - "Unit": "None", - "Value": 5.0, - } - ) + assert { + "Adjustable": True, + "GlobalQuota": False, + "QuotaArn": "arn:aws:servicequotas:eu-west-1::vpc/L-2AFB9258", + "QuotaCode": "L-2AFB9258", + "QuotaName": "Security groups per network interface", + "ServiceCode": "vpc", + "ServiceName": "Amazon Virtual Private Cloud (Amazon VPC)", + "Unit": "None", + "Value": 5.0, + } in resp["Quotas"] + assert { + "Adjustable": True, + "GlobalQuota": False, + "QuotaArn": "arn:aws:servicequotas:eu-west-1::vpc/L-F678F1CE", + "QuotaCode": "L-F678F1CE", + "QuotaName": "VPCs per Region", + "ServiceCode": "vpc", + "ServiceName": "Amazon Virtual Private Cloud (Amazon VPC)", + "Unit": "None", + "Value": 5.0, + } in resp["Quotas"] @mock_servicequotas @@ -51,9 +47,10 @@ def test_list_defaults_for_unknown_service(): with pytest.raises(ClientError) as exc: client.list_aws_default_service_quotas(ServiceCode="unknown") err = exc.value.response["Error"] - err["Code"].should.equal("NoSuchResourceException") - err["Message"].should.equal( - "This service is not available in the current Region. Choose a different Region or a different service." + assert err["Code"] == "NoSuchResourceException" + assert err["Message"] == ( + "This service is not available in the current Region. Choose a " + "different Region or a different service." ) @@ -64,7 +61,7 @@ def test_get_service_quota(): for quota in quotas: resp = client.get_service_quota(ServiceCode="vpc", QuotaCode=quota["QuotaCode"]) - quota.should.equal(resp["Quota"]) + assert quota == resp["Quota"] @mock_servicequotas @@ -74,4 +71,4 @@ def test_get_unknown_service_quota(): with pytest.raises(ClientError) as exc: client.get_service_quota(ServiceCode="vpc", QuotaCode="unknown") err = exc.value.response["Error"] - err["Code"].should.equal("NoSuchResourceException") + assert err["Code"] == "NoSuchResourceException"