Repository: getmoto/moto
Pull request #6642 (2023-08-12 20:49:26)

Techdebt: Replace sure with regular assertions in ManagedBlockchain


Patch:
diff --git a/moto/backend_index.py b/moto/backend_index.py
index 5f57542fb..fc1508f28 100644
--- a/moto/backend_index.py
+++ b/moto/backend_index.py
@@ -114,7 +114,7 @@ backend_url_patterns = [
     ),
     (
         "meteringmarketplace",
-        re.compile("https?://metering.marketplace.(.+).amazonaws.com"),
+        re.compile("https?://metering\\.marketplace.(.+).amazonaws.com"),
     ),
     ("meteringmarketplace", re.compile("https?://aws-marketplace.(.+).amazonaws.com")),
     ("mq", re.compile("https?://mq\\.(.+)\\.amazonaws\\.com")),
diff --git a/moto/core/versions.py b/moto/core/versions.py
index 8aa754f10..16a1df52d 100644
--- a/moto/core/versions.py
+++ b/moto/core/versions.py
@@ -3,7 +3,7 @@ from moto.utilities.distutils_version import LooseVersion
 try:
     from importlib.metadata import version
 except ImportError:
-    from importlib_metadata import version
+    from importlib_metadata import version  # type: ignore[no-redef]
 
 
 RESPONSES_VERSION = version("responses")
diff --git a/moto/sagemaker/models.py b/moto/sagemaker/models.py
index a5bf3c6da..726eab895 100644
--- a/moto/sagemaker/models.py
+++ b/moto/sagemaker/models.py
@@ -3,6 +3,7 @@ import os
 import random
 import string
 from datetime import datetime
+from dateutil.tz import tzutc
 from typing import Any, Dict, List, Optional, Iterable, Union
 
 from moto.core import BaseBackend, BackendDict, BaseModel, CloudFormationModel
@@ -994,7 +995,7 @@ class ModelPackage(BaseObject):
             _type="model-package",
             _id=model_package_name,
         )
-        datetime_now = datetime.utcnow()
+        datetime_now = datetime.now(tzutc())
         self.model_package_name = model_package_name
         self.model_package_group_name = model_package_group_name
         self.model_package_version = model_package_version
@@ -2868,9 +2869,13 @@ class SageMakerModelBackend(BaseBackend):
         sort_order: Optional[str],
     ) -> List[ModelPackage]:
         if isinstance(creation_time_before, int):
-            creation_time_before_datetime = datetime.fromtimestamp(creation_time_before)
+            creation_time_before_datetime = datetime.fromtimestamp(
+                creation_time_before, tz=tzutc()
+            )
         if isinstance(creation_time_after, int):
-            creation_time_after_datetime = datetime.fromtimestamp(creation_time_after)
+            creation_time_after_datetime = datetime.fromtimestamp(
+                creation_time_after, tz=tzutc()
+            )
         if model_package_group_name is not None:
             model_package_type = "Versioned"
         model_package_summary_list = list(
diff --git a/moto/scheduler/exceptions.py b/moto/scheduler/exceptions.py
index cb126594b..0e180c2c1 100644
--- a/moto/scheduler/exceptions.py
+++ b/moto/scheduler/exceptions.py
@@ -2,6 +2,11 @@
 from moto.core.exceptions import JsonRESTError
 
 
+class ScheduleExists(JsonRESTError):
+    def __init__(self, name: str) -> None:
+        super().__init__("ConflictException", f"Schedule {name} already exists.")
+
+
 class ScheduleNotFound(JsonRESTError):
     def __init__(self) -> None:
         super().__init__("ResourceNotFoundException", "Schedule not found")
diff --git a/moto/scheduler/models.py b/moto/scheduler/models.py
index f6a559a96..090e9fc53 100644
--- a/moto/scheduler/models.py
+++ b/moto/scheduler/models.py
@@ -5,6 +5,7 @@ from moto.core import BaseBackend, BackendDict, BaseModel
 from moto.core.utils import unix_time
 from moto.utilities.tagging_service import TaggingService
 
+from .exceptions import ScheduleExists
 from .exceptions import ScheduleNotFound, ScheduleGroupNotFound
 
 
@@ -155,6 +156,8 @@ class EventBridgeSchedulerBackend(BaseBackend):
         The ClientToken parameter is not yet implemented
         """
         group = self.schedule_groups[group_name or "default"]
+        if name in group.schedules:
+            raise ScheduleExists(name)
         schedule = Schedule(
             region=self.region_name,
             account_id=self.account_id,


Test patch:
diff --git a/tests/test_awslambda/test_lambda_alias.py b/tests/test_awslambda/test_lambda_alias.py
index 00ade02f7..88049347f 100644
--- a/tests/test_awslambda/test_lambda_alias.py
+++ b/tests/test_awslambda/test_lambda_alias.py
@@ -1,12 +1,12 @@
 """Unit tests for lambda-supported APIs."""
+from uuid import uuid4
+
 import boto3
+from botocore.exceptions import ClientError
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 
-from botocore.exceptions import ClientError
 from moto import mock_lambda
 from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
-from uuid import uuid4
 from .utilities import (
     get_role_name,
     get_test_zip_file1,
@@ -195,9 +195,9 @@ def test_aliases_are_unique_per_function():
 
     err = exc.value.response["Error"]
     assert err["Code"] == "ConflictException"
-    assert (
-        err["Message"]
-        == f"Alias already exists: arn:aws:lambda:us-west-1:{ACCOUNT_ID}:function:{function_name}:alias1"
+    assert err["Message"] == (
+        f"Alias already exists: arn:aws:lambda:us-west-1:{ACCOUNT_ID}"
+        f":function:{function_name}:alias1"
     )
 
 
@@ -278,9 +278,9 @@ def test_get_unknown_alias():
         client.get_alias(FunctionName=function_name, Name="unknown")
     err = exc.value.response["Error"]
     assert err["Code"] == "ResourceNotFoundException"
-    assert (
-        err["Message"]
-        == f"Cannot find alias arn: arn:aws:lambda:us-west-1:{ACCOUNT_ID}:function:{function_name}:unknown"
+    assert err["Message"] == (
+        f"Cannot find alias arn: arn:aws:lambda:us-west-1:{ACCOUNT_ID}"
+        f":function:{function_name}:unknown"
     )
 
 
diff --git a/tests/test_ec2/test_server.py b/tests/test_ec2/test_server.py
index 837e0053e..1061ea1dc 100644
--- a/tests/test_ec2/test_server.py
+++ b/tests/test_ec2/test_server.py
@@ -1,14 +1,10 @@
+"""Test the different server responses."""
 import re
-import sure  # noqa # pylint: disable=unused-import
 import xmltodict
 
 import moto.server as server
 from tests import EXAMPLE_AMI_ID
 
-"""
-Test the different server responses
-"""
-
 
 def test_ec2_server_get():
     backend = server.create_backend_app("ec2")
diff --git a/tests/test_managedblockchain/helpers.py b/tests/test_managedblockchain/helpers.py
index 91a79732f..4856862f4 100644
--- a/tests/test_managedblockchain/helpers.py
+++ b/tests/test_managedblockchain/helpers.py
@@ -38,12 +38,7 @@ default_nodeconfiguration = {
 
 
 def member_id_exist_in_list(members, memberid):
-    memberidxists = False
-    for member in members:
-        if member["Id"] == memberid:
-            memberidxists = True
-            break
-    return memberidxists
+    return any([member["Id"] == memberid for member in members])
 
 
 def create_member_configuration(
@@ -76,9 +71,4 @@ def select_invitation_id_for_network(invitations, networkid, status=None):
 
 
 def node_id_exist_in_list(nodes, nodeid):
-    nodeidxists = False
-    for node in nodes:
-        if node["Id"] == nodeid:
-            nodeidxists = True
-            break
-    return nodeidxists
+    return any([node["Id"] == nodeid for node in nodes])
diff --git a/tests/test_managedblockchain/test_managedblockchain_invitations.py b/tests/test_managedblockchain/test_managedblockchain_invitations.py
index 104cb2a95..7e0564898 100644
--- a/tests/test_managedblockchain/test_managedblockchain_invitations.py
+++ b/tests/test_managedblockchain/test_managedblockchain_invitations.py
@@ -1,6 +1,5 @@
 import boto3
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 
 from botocore.exceptions import ClientError
 from moto import mock_managedblockchain
@@ -24,20 +23,19 @@ def test_create_2_invitations():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id,
         MemberId=member_id,
         Actions=helpers.multiple_policy_actions,
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -46,11 +44,11 @@ def test_create_2_invitations():
 
     # Get the invitation
     response = conn.list_invitations()
-    response["Invitations"].should.have.length_of(2)
-    response["Invitations"][0]["NetworkSummary"]["Id"].should.equal(network_id)
-    response["Invitations"][0]["Status"].should.equal("PENDING")
-    response["Invitations"][1]["NetworkSummary"]["Id"].should.equal(network_id)
-    response["Invitations"][1]["Status"].should.equal("PENDING")
+    assert len(response["Invitations"]) == 2
+    assert response["Invitations"][0]["NetworkSummary"]["Id"] == network_id
+    assert response["Invitations"][0]["Status"] == "PENDING"
+    assert response["Invitations"][1]["NetworkSummary"]["Id"] == network_id
+    assert response["Invitations"][1]["Status"] == "PENDING"
 
 
 @mock_managedblockchain
@@ -70,18 +68,17 @@ def test_reject_invitation():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -90,17 +87,17 @@ def test_reject_invitation():
 
     # Get the invitation
     response = conn.list_invitations()
-    response["Invitations"][0]["NetworkSummary"]["Id"].should.equal(network_id)
-    response["Invitations"][0]["Status"].should.equal("PENDING")
+    assert response["Invitations"][0]["NetworkSummary"]["Id"] == network_id
+    assert response["Invitations"][0]["Status"] == "PENDING"
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Reject - thanks but no thanks
-    response = conn.reject_invitation(InvitationId=invitation_id)
+    conn.reject_invitation(InvitationId=invitation_id)
 
     # Check the invitation status
     response = conn.list_invitations()
-    response["Invitations"][0]["InvitationId"].should.equal(invitation_id)
-    response["Invitations"][0]["Status"].should.equal("REJECTED")
+    assert response["Invitations"][0]["InvitationId"] == invitation_id
+    assert response["Invitations"][0]["Status"] == "REJECTED"
 
 
 @mock_managedblockchain
@@ -119,13 +116,11 @@ def test_reject_invitation_badinvitation():
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
 
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
+    )["ProposalId"]
 
-    proposal_id = response["ProposalId"]
-
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -135,7 +130,5 @@ def test_reject_invitation_badinvitation():
     with pytest.raises(ClientError) as ex:
         conn.reject_invitation(InvitationId="in-ABCDEFGHIJKLMNOP0123456789")
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain(
-        "InvitationId in-ABCDEFGHIJKLMNOP0123456789 not found."
-    )
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "InvitationId in-ABCDEFGHIJKLMNOP0123456789 not found." in err["Message"]
diff --git a/tests/test_managedblockchain/test_managedblockchain_members.py b/tests/test_managedblockchain/test_managedblockchain_members.py
index 94b7d7f6f..3b41e24c5 100644
--- a/tests/test_managedblockchain/test_managedblockchain_members.py
+++ b/tests/test_managedblockchain/test_managedblockchain_members.py
@@ -1,6 +1,5 @@
 import boto3
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 
 from botocore.exceptions import ClientError, ParamValidationError
 from moto import mock_managedblockchain
@@ -25,18 +24,17 @@ def test_create_another_member():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -45,34 +43,32 @@ def test_create_another_member():
 
     # Get the invitation
     response = conn.list_invitations()
-    response["Invitations"][0]["NetworkSummary"]["Id"].should.equal(network_id)
-    response["Invitations"][0]["Status"].should.equal("PENDING")
+    assert response["Invitations"][0]["NetworkSummary"]["Id"] == network_id
+    assert response["Invitations"][0]["Status"] == "PENDING"
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    member_id2 = conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
             "testmember2", "admin", "Admin12345", False
         ),
-    )
-    member_id2 = response["MemberId"]
+    )["MemberId"]
 
     # Check the invitation status
     response = conn.list_invitations()
-    response["Invitations"][0]["InvitationId"].should.equal(invitation_id)
-    response["Invitations"][0]["Status"].should.equal("ACCEPTED")
+    assert response["Invitations"][0]["InvitationId"] == invitation_id
+    assert response["Invitations"][0]["Status"] == "ACCEPTED"
 
     # Find member in full list
-    response = conn.list_members(NetworkId=network_id)
-    members = response["Members"]
-    members.should.have.length_of(2)
-    helpers.member_id_exist_in_list(members, member_id2).should.equal(True)
+    members = conn.list_members(NetworkId=network_id)["Members"]
+    assert len(members) == 2
+    assert helpers.member_id_exist_in_list(members, member_id2) is True
 
     # Get member 2 details
     response = conn.get_member(NetworkId=network_id, MemberId=member_id2)
-    response["Member"]["Name"].should.equal("testmember2")
+    assert response["Member"]["Name"] == "testmember2"
 
     # Update member
     logconfignewenabled = not helpers.default_memberconfiguration[
@@ -89,9 +85,10 @@ def test_create_another_member():
 
     # Get member 2 details
     response = conn.get_member(NetworkId=network_id, MemberId=member_id2)
-    response["Member"]["LogPublishingConfiguration"]["Fabric"]["CaLogs"]["Cloudwatch"][
-        "Enabled"
-    ].should.equal(logconfignewenabled)
+    cloudwatch = response["Member"]["LogPublishingConfiguration"]["Fabric"]["CaLogs"][
+        "Cloudwatch"
+    ]
+    assert cloudwatch["Enabled"] == logconfignewenabled
 
 
 @mock_managedblockchain
@@ -111,18 +108,17 @@ def test_create_another_member_withopts():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -131,34 +127,32 @@ def test_create_another_member_withopts():
 
     # Get the invitation
     response = conn.list_invitations()
-    response["Invitations"][0]["NetworkSummary"]["Id"].should.equal(network_id)
-    response["Invitations"][0]["Status"].should.equal("PENDING")
+    assert response["Invitations"][0]["NetworkSummary"]["Id"] == network_id
+    assert response["Invitations"][0]["Status"] == "PENDING"
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    member_id2 = conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
             "testmember2", "admin", "Admin12345", False, "Test Member 2"
         ),
-    )
-    member_id2 = response["MemberId"]
+    )["MemberId"]
 
     # Check the invitation status
     response = conn.list_invitations()
-    response["Invitations"][0]["InvitationId"].should.equal(invitation_id)
-    response["Invitations"][0]["Status"].should.equal("ACCEPTED")
+    assert response["Invitations"][0]["InvitationId"] == invitation_id
+    assert response["Invitations"][0]["Status"] == "ACCEPTED"
 
     # Find member in full list
-    response = conn.list_members(NetworkId=network_id)
-    members = response["Members"]
-    members.should.have.length_of(2)
-    helpers.member_id_exist_in_list(members, member_id2).should.equal(True)
+    members = conn.list_members(NetworkId=network_id)["Members"]
+    assert len(members) == 2
+    assert helpers.member_id_exist_in_list(members, member_id2) is True
 
     # Get member 2 details
     response = conn.get_member(NetworkId=network_id, MemberId=member_id2)
-    response["Member"]["Description"].should.equal("Test Member 2")
+    assert response["Member"]["Description"] == "Test Member 2"
 
     # Try to create member with already used invitation
     with pytest.raises(ClientError) as ex:
@@ -170,38 +164,36 @@ def test_create_another_member_withopts():
             ),
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain(f"Invitation {invitation_id} not valid")
+    assert err["Code"] == "InvalidRequestException"
+    assert f"Invitation {invitation_id} not valid" in err["Message"]
 
     # Delete member 2
     conn.delete_member(NetworkId=network_id, MemberId=member_id2)
 
     # Member is still in the list
-    response = conn.list_members(NetworkId=network_id)
-    members = response["Members"]
-    members.should.have.length_of(2)
+    members = conn.list_members(NetworkId=network_id)["Members"]
+    assert len(members) == 2
 
     # But cannot get
     with pytest.raises(ClientError) as ex:
         conn.get_member(NetworkId=network_id, MemberId=member_id2)
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain(f"Member {member_id2} not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert f"Member {member_id2} not found" in err["Message"]
 
     # Delete member 1
     conn.delete_member(NetworkId=network_id, MemberId=member_id)
 
     # Network should be gone
-    response = conn.list_networks()
-    mbcnetworks = response["Networks"]
-    mbcnetworks.should.have.length_of(0)
+    mbcnetworks = conn.list_networks()["Networks"]
+    assert len(mbcnetworks) == 0
 
     # Verify the invitation network status is DELETED
     # Get the invitation
     response = conn.list_invitations()
-    response["Invitations"].should.have.length_of(1)
-    response["Invitations"][0]["NetworkSummary"]["Id"].should.equal(network_id)
-    response["Invitations"][0]["NetworkSummary"]["Status"].should.equal("DELETED")
+    assert len(response["Invitations"]) == 1
+    assert response["Invitations"][0]["NetworkSummary"]["Id"] == network_id
+    assert response["Invitations"][0]["NetworkSummary"]["Status"] == "DELETED"
 
 
 @mock_managedblockchain
@@ -221,13 +213,12 @@ def test_invite_and_remove_member():
     member_id = response["MemberId"]
 
     # Create proposal (create additional member)
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -239,14 +230,13 @@ def test_invite_and_remove_member():
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    member_id2 = conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
             "testmember2", "admin", "Admin12345", False, "Test Member 2"
         ),
-    )
-    member_id2 = response["MemberId"]
+    )["MemberId"]
 
     both_policy_actions = {
         "Invitations": [{"Principal": "123456789012"}],
@@ -254,18 +244,17 @@ def test_invite_and_remove_member():
     }
 
     # Create proposal (invite and remove member)
-    response = conn.create_proposal(
+    proposal_id2 = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=both_policy_actions
-    )
-    proposal_id2 = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id2)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id2,
         VoterMemberId=member_id,
@@ -277,17 +266,16 @@ def test_invite_and_remove_member():
     invitations = helpers.select_invitation_id_for_network(
         response["Invitations"], network_id, "PENDING"
     )
-    invitations.should.have.length_of(1)
+    assert len(invitations) == 1
 
     # Member is still in the list
-    response = conn.list_members(NetworkId=network_id)
-    members = response["Members"]
-    members.should.have.length_of(2)
+    members = conn.list_members(NetworkId=network_id)["Members"]
+    assert len(members) == 2
     foundmember2 = False
     for member in members:
         if member["Id"] == member_id2 and member["Status"] == "DELETED":
             foundmember2 = True
-    foundmember2.should.equal(True)
+    assert foundmember2 is True
 
 
 @mock_managedblockchain
@@ -309,15 +297,14 @@ def test_create_too_many_members():
     # Create 4 more members - create invitations for 5
     for counter in range(2, 7):
         # Create proposal
-        response = conn.create_proposal(
+        proposal_id = conn.create_proposal(
             NetworkId=network_id,
             MemberId=member_id,
             Actions=helpers.default_policy_actions,
-        )
-        proposal_id = response["ProposalId"]
+        )["ProposalId"]
 
         # Vote yes
-        response = conn.vote_on_proposal(
+        conn.vote_on_proposal(
             NetworkId=network_id,
             ProposalId=proposal_id,
             VoterMemberId=member_id,
@@ -346,14 +333,13 @@ def test_create_too_many_members():
         member_id = response["MemberId"]
 
         # Find member in full list
-        response = conn.list_members(NetworkId=network_id)
-        members = response["Members"]
-        members.should.have.length_of(counter)
-        helpers.member_id_exist_in_list(members, member_id).should.equal(True)
+        members = conn.list_members(NetworkId=network_id)["Members"]
+        assert len(members) == counter
+        assert helpers.member_id_exist_in_list(members, member_id) is True
 
         # Get member details
         response = conn.get_member(NetworkId=network_id, MemberId=member_id)
-        response["Member"]["Description"].should.equal("Test Member " + str(counter))
+        assert response["Member"]["Description"] == "Test Member " + str(counter)
 
     # Try to create the sixth
     response = conn.list_invitations()
@@ -371,8 +357,8 @@ def test_create_too_many_members():
             ),
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceLimitExceededException")
-    err["Message"].should.contain("is the maximum number of members allowed in a")
+    assert err["Code"] == "ResourceLimitExceededException"
+    assert "is the maximum number of members allowed in a" in err["Message"]
 
 
 @mock_managedblockchain
@@ -393,13 +379,12 @@ def test_create_another_member_alreadyhave():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -420,9 +405,10 @@ def test_create_another_member_alreadyhave():
             ),
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain(
+    assert err["Code"] == "InvalidRequestException"
+    assert (
         f"Member name testmember1 already exists in network {network_id}"
+        in err["Message"]
     )
 
 
@@ -439,8 +425,8 @@ def test_create_another_member_badnetwork():
             ),
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -448,15 +434,14 @@ def test_create_another_member_badinvitation():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.create_member(
@@ -467,8 +452,8 @@ def test_create_another_member_badinvitation():
             ),
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain("Invitation in-ABCDEFGHIJKLMNOP0123456789 not valid")
+    assert err["Code"] == "InvalidRequestException"
+    assert "Invitation in-ABCDEFGHIJKLMNOP0123456789 not valid" in err["Message"]
 
 
 @mock_managedblockchain
@@ -488,18 +473,17 @@ def test_create_another_member_adminpassword():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -525,8 +509,9 @@ def test_create_another_member_adminpassword():
             MemberConfiguration=badadminpassmemberconf,
         )
     err = ex.value
-    str(err).should.contain(
+    assert (
         "Invalid length for parameter MemberConfiguration.FrameworkConfiguration.Fabric.AdminPassword"
+        in str(err)
     )
 
     # No uppercase or numbers
@@ -540,8 +525,8 @@ def test_create_another_member_adminpassword():
             MemberConfiguration=badadminpassmemberconf,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
     # No lowercase or numbers
     badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][
@@ -554,8 +539,8 @@ def test_create_another_member_adminpassword():
             MemberConfiguration=badadminpassmemberconf,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
     # No numbers
     badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][
@@ -568,8 +553,8 @@ def test_create_another_member_adminpassword():
             MemberConfiguration=badadminpassmemberconf,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
     # Invalid character
     badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][
@@ -582,8 +567,8 @@ def test_create_another_member_adminpassword():
             MemberConfiguration=badadminpassmemberconf,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
 
 @mock_managedblockchain
@@ -593,8 +578,8 @@ def test_list_members_badnetwork():
     with pytest.raises(ClientError) as ex:
         conn.list_members(NetworkId="n-ABCDEFGHIJKLMNOP0123456789")
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -607,8 +592,8 @@ def test_get_member_badnetwork():
             MemberId="m-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -616,21 +601,20 @@ def test_get_member_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.get_member(NetworkId=network_id, MemberId="m-ABCDEFGHIJKLMNOP0123456789")
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -643,8 +627,8 @@ def test_delete_member_badnetwork():
             MemberId="m-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -652,23 +636,22 @@ def test_delete_member_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.delete_member(
             NetworkId=network_id, MemberId="m-ABCDEFGHIJKLMNOP0123456789"
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -684,8 +667,8 @@ def test_update_member_badnetwork():
             ],
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -693,15 +676,14 @@ def test_update_member_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.update_member(
@@ -712,5 +694,5 @@ def test_update_member_badmember():
             ],
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
diff --git a/tests/test_managedblockchain/test_managedblockchain_networks.py b/tests/test_managedblockchain/test_managedblockchain_networks.py
index 75f9ffd5d..38882b85c 100644
--- a/tests/test_managedblockchain/test_managedblockchain_networks.py
+++ b/tests/test_managedblockchain/test_managedblockchain_networks.py
@@ -1,6 +1,5 @@
 import boto3
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 
 from botocore.exceptions import ClientError
 from moto import mock_managedblockchain
@@ -21,18 +20,19 @@ def test_create_network():
     )
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
-    network_id.should.match("n-[A-Z0-9]{26}")
-    member_id.should.match("m-[A-Z0-9]{26}")
+    assert network_id.startswith("n-")
+    assert len(network_id) == 28
+    assert member_id.startswith("m-")
+    assert len(member_id) == 28
 
     # Find in full list
-    response = conn.list_networks()
-    mbcnetworks = response["Networks"]
-    mbcnetworks.should.have.length_of(1)
-    mbcnetworks[0]["Name"].should.equal("testnetwork1")
+    mbcnetworks = conn.list_networks()["Networks"]
+    assert len(mbcnetworks) == 1
+    assert mbcnetworks[0]["Name"] == "testnetwork1"
 
     # Get network details
     response = conn.get_network(NetworkId=network_id)
-    response["Network"]["Name"].should.equal("testnetwork1")
+    assert response["Network"]["Name"] == "testnetwork1"
 
 
 @mock_managedblockchain
@@ -50,18 +50,19 @@ def test_create_network_withopts():
     )
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
-    network_id.should.match("n-[A-Z0-9]{26}")
-    member_id.should.match("m-[A-Z0-9]{26}")
+    assert network_id.startswith("n-")
+    assert len(network_id) == 28
+    assert member_id.startswith("m-")
+    assert len(member_id) == 28
 
     # Find in full list
-    response = conn.list_networks()
-    mbcnetworks = response["Networks"]
-    mbcnetworks.should.have.length_of(1)
-    mbcnetworks[0]["Description"].should.equal("Test Network 1")
+    mbcnetworks = conn.list_networks()["Networks"]
+    assert len(mbcnetworks) == 1
+    assert mbcnetworks[0]["Description"] == "Test Network 1"
 
     # Get network details
     response = conn.get_network(NetworkId=network_id)
-    response["Network"]["Description"].should.equal("Test Network 1")
+    assert response["Network"]["Description"] == "Test Network 1"
 
 
 @mock_managedblockchain
@@ -79,8 +80,8 @@ def test_create_network_noframework():
             MemberConfiguration=helpers.default_memberconfiguration,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
 
 @mock_managedblockchain
@@ -98,9 +99,10 @@ def test_create_network_badframeworkver():
             MemberConfiguration=helpers.default_memberconfiguration,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain(
+    assert err["Code"] == "BadRequestException"
+    assert (
         "Invalid version 1.X requested for framework HYPERLEDGER_FABRIC"
+        in err["Message"]
     )
 
 
@@ -121,8 +123,8 @@ def test_create_network_badedition():
             MemberConfiguration=helpers.default_memberconfiguration,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
 
 @mock_managedblockchain
@@ -132,5 +134,5 @@ def test_get_network_badnetwork():
     with pytest.raises(ClientError) as ex:
         conn.get_network(NetworkId="n-ABCDEFGHIJKLMNOP0123456789")
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
diff --git a/tests/test_managedblockchain/test_managedblockchain_nodes.py b/tests/test_managedblockchain/test_managedblockchain_nodes.py
index bf8056c73..e3ca9b8fb 100644
--- a/tests/test_managedblockchain/test_managedblockchain_nodes.py
+++ b/tests/test_managedblockchain/test_managedblockchain_nodes.py
@@ -1,6 +1,5 @@
 import boto3
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 
 from botocore.exceptions import ClientError
 from moto import mock_managedblockchain
@@ -25,22 +24,20 @@ def test_create_node():
     member_id = response["MemberId"]
 
     # Create a node
-    response = conn.create_node(
+    node_id = conn.create_node(
         NetworkId=network_id,
         MemberId=member_id,
         NodeConfiguration=helpers.default_nodeconfiguration,
-    )
-    node_id = response["NodeId"]
+    )["NodeId"]
 
     # Find node in full list
-    response = conn.list_nodes(NetworkId=network_id, MemberId=member_id)
-    nodes = response["Nodes"]
-    nodes.should.have.length_of(1)
-    helpers.node_id_exist_in_list(nodes, node_id).should.equal(True)
+    nodes = conn.list_nodes(NetworkId=network_id, MemberId=member_id)["Nodes"]
+    assert len(nodes) == 1
+    assert helpers.node_id_exist_in_list(nodes, node_id) is True
 
     # Get node details
     response = conn.get_node(NetworkId=network_id, MemberId=member_id, NodeId=node_id)
-    response["Node"]["AvailabilityZone"].should.equal("us-east-1a")
+    assert response["Node"]["AvailabilityZone"] == "us-east-1a"
 
     # Update node
     logconfignewenabled = not helpers.default_nodeconfiguration[
@@ -60,25 +57,23 @@ def test_create_node():
     conn.delete_node(NetworkId=network_id, MemberId=member_id, NodeId=node_id)
 
     # Find node in full list
-    response = conn.list_nodes(NetworkId=network_id, MemberId=member_id)
-    nodes = response["Nodes"]
-    nodes.should.have.length_of(1)
-    helpers.node_id_exist_in_list(nodes, node_id).should.equal(True)
+    nodes = conn.list_nodes(NetworkId=network_id, MemberId=member_id)["Nodes"]
+    assert len(nodes) == 1
+    assert helpers.node_id_exist_in_list(nodes, node_id) is True
 
     # Find node in full list - only DELETED
-    response = conn.list_nodes(
-        NetworkId=network_id, MemberId=member_id, Status="DELETED"
-    )
-    nodes = response["Nodes"]
-    nodes.should.have.length_of(1)
-    helpers.node_id_exist_in_list(nodes, node_id).should.equal(True)
+    nodes = conn.list_nodes(NetworkId=network_id, MemberId=member_id, Status="DELETED")[
+        "Nodes"
+    ]
+    assert len(nodes) == 1
+    assert helpers.node_id_exist_in_list(nodes, node_id) is True
 
     # But cannot get
     with pytest.raises(ClientError) as ex:
         conn.get_node(NetworkId=network_id, MemberId=member_id, NodeId=node_id)
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain(f"Node {node_id} not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert f"Node {node_id} not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -102,24 +97,22 @@ def test_create_node_standard_edition():
     # Instance type only allowed with standard edition
     logconfigbad = dict(helpers.default_nodeconfiguration)
     logconfigbad["InstanceType"] = "bc.t3.large"
-    response = conn.create_node(
+    node_id = conn.create_node(
         NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad
-    )
-    node_id = response["NodeId"]
+    )["NodeId"]
 
     # Get node details
     response = conn.get_node(NetworkId=network_id, MemberId=member_id, NodeId=node_id)
-    response["Node"]["InstanceType"].should.equal("bc.t3.large")
+    assert response["Node"]["InstanceType"] == "bc.t3.large"
 
     # Need another member so the network does not get deleted
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -131,7 +124,7 @@ def test_create_node_standard_edition():
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
@@ -146,8 +139,8 @@ def test_create_node_standard_edition():
     with pytest.raises(ClientError) as ex:
         conn.list_nodes(NetworkId=network_id, MemberId=member_id)
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain(f"Member {member_id} not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert f"Member {member_id} not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -168,23 +161,22 @@ def test_create_too_many_nodes():
     member_id = response["MemberId"]
 
     # Create a node
-    response = conn.create_node(
+    conn.create_node(
         NetworkId=network_id,
         MemberId=member_id,
         NodeConfiguration=helpers.default_nodeconfiguration,
     )
 
     # Create another node
-    response = conn.create_node(
+    conn.create_node(
         NetworkId=network_id,
         MemberId=member_id,
         NodeConfiguration=helpers.default_nodeconfiguration,
     )
 
     # Find node in full list
-    response = conn.list_nodes(NetworkId=network_id, MemberId=member_id)
-    nodes = response["Nodes"]
-    nodes.should.have.length_of(2)
+    nodes = conn.list_nodes(NetworkId=network_id, MemberId=member_id)["Nodes"]
+    assert len(nodes) == 2
 
     # Try to create one too many nodes
     with pytest.raises(ClientError) as ex:
@@ -194,10 +186,8 @@ def test_create_too_many_nodes():
             NodeConfiguration=helpers.default_nodeconfiguration,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceLimitExceededException")
-    err["Message"].should.contain(
-        f"Maximum number of nodes exceeded in member {member_id}"
-    )
+    assert err["Code"] == "ResourceLimitExceededException"
+    assert f"Maximum number of nodes exceeded in member {member_id}" in err["Message"]
 
 
 @mock_managedblockchain
@@ -211,15 +201,15 @@ def test_create_node_badnetwork():
             NodeConfiguration=helpers.default_nodeconfiguration,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
 def test_create_node_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Description="Test Network 1",
         Framework="HYPERLEDGER_FABRIC",
@@ -227,8 +217,7 @@ def test_create_node_badmember():
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.create_node(
@@ -237,8 +226,8 @@ def test_create_node_badmember():
             NodeConfiguration=helpers.default_nodeconfiguration,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -265,8 +254,8 @@ def test_create_node_badnodeconfig():
             NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain("Requested instance foo isn't supported.")
+    assert err["Code"] == "InvalidRequestException"
+    assert "Requested instance foo isn't supported." in err["Message"]
 
     # Incorrect instance type for edition
     logconfigbad = dict(helpers.default_nodeconfiguration)
@@ -276,9 +265,10 @@ def test_create_node_badnodeconfig():
             NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain(
+    assert err["Code"] == "InvalidRequestException"
+    assert (
         "Instance type bc.t3.large is not supported with STARTER Edition networks."
+        in err["Message"]
     )
 
     # Incorrect availability zone
@@ -289,8 +279,8 @@ def test_create_node_badnodeconfig():
             NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain("Availability Zone is not valid")
+    assert err["Code"] == "InvalidRequestException"
+    assert "Availability Zone is not valid" in err["Message"]
 
 
 @mock_managedblockchain
@@ -303,15 +293,15 @@ def test_list_nodes_badnetwork():
             MemberId="m-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
 def test_list_nodes_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Description="Test Network 1",
         Framework="HYPERLEDGER_FABRIC",
@@ -319,14 +309,13 @@ def test_list_nodes_badmember():
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.list_nodes(NetworkId=network_id, MemberId="m-ABCDEFGHIJKLMNOP0123456789")
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -340,15 +329,15 @@ def test_get_node_badnetwork():
             NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
 def test_get_node_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Description="Test Network 1",
         Framework="HYPERLEDGER_FABRIC",
@@ -356,8 +345,7 @@ def test_get_node_badmember():
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.get_node(
@@ -366,8 +354,8 @@ def test_get_node_badmember():
             NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -393,8 +381,8 @@ def test_get_node_badnode():
             NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Node nd-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Node nd-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -408,15 +396,15 @@ def test_delete_node_badnetwork():
             NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
 def test_delete_node_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Description="Test Network 1",
         Framework="HYPERLEDGER_FABRIC",
@@ -424,8 +412,7 @@ def test_delete_node_badmember():
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.delete_node(
@@ -434,8 +421,8 @@ def test_delete_node_badmember():
             NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -461,8 +448,8 @@ def test_delete_node_badnode():
             NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Node nd-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Node nd-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -479,15 +466,15 @@ def test_update_node_badnetwork():
             ],
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
 def test_update_node_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Description="Test Network 1",
         Framework="HYPERLEDGER_FABRIC",
@@ -495,8 +482,7 @@ def test_update_node_badmember():
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.update_node(
@@ -508,8 +494,8 @@ def test_update_node_badmember():
             ],
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -538,5 +524,5 @@ def test_update_node_badnode():
             ],
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Node nd-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Node nd-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
diff --git a/tests/test_managedblockchain/test_managedblockchain_proposals.py b/tests/test_managedblockchain/test_managedblockchain_proposals.py
index 84bcfc902..705d062c0 100644
--- a/tests/test_managedblockchain/test_managedblockchain_proposals.py
+++ b/tests/test_managedblockchain/test_managedblockchain_proposals.py
@@ -1,6 +1,5 @@
 import boto3
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 
 from botocore.exceptions import ClientError
 from moto import mock_managedblockchain
@@ -22,25 +21,22 @@ def test_create_proposal():
     )
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
-    network_id.should.match("n-[A-Z0-9]{26}")
-    member_id.should.match("m-[A-Z0-9]{26}")
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
-    proposal_id.should.match("p-[A-Z0-9]{26}")
+    )["ProposalId"]
+    assert proposal_id.startswith("p-")
+    assert len(proposal_id) == 28
 
     # Find in full list
-    response = conn.list_proposals(NetworkId=network_id)
-    proposals = response["Proposals"]
-    proposals.should.have.length_of(1)
-    proposals[0]["ProposalId"].should.equal(proposal_id)
+    proposals = conn.list_proposals(NetworkId=network_id)["Proposals"]
+    assert len(proposals) == 1
+    assert proposals[0]["ProposalId"] == proposal_id
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
+    assert response["Proposal"]["NetworkId"] == network_id
 
 
 @mock_managedblockchain
@@ -58,22 +54,18 @@ def test_create_proposal_withopts():
     )
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
-    network_id.should.match("n-[A-Z0-9]{26}")
-    member_id.should.match("m-[A-Z0-9]{26}")
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id,
         MemberId=member_id,
         Actions=helpers.default_policy_actions,
         Description="Adding a new member",
-    )
-    proposal_id = response["ProposalId"]
-    proposal_id.should.match("p-[A-Z0-9]{26}")
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["Description"].should.equal("Adding a new member")
+    assert response["Proposal"]["Description"] == "Adding a new member"
 
 
 @mock_managedblockchain
@@ -87,8 +79,8 @@ def test_create_proposal_badnetwork():
             Actions=helpers.default_policy_actions,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -96,15 +88,14 @@ def test_create_proposal_badmember():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.create_proposal(
@@ -113,8 +104,8 @@ def test_create_proposal_badmember():
             Actions=helpers.default_policy_actions,
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -139,10 +130,8 @@ def test_create_proposal_badinvitationacctid():
     with pytest.raises(ClientError) as ex:
         conn.create_proposal(NetworkId=network_id, MemberId=member_id, Actions=actions)
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain(
-        "Account ID format specified in proposal is not valid"
-    )
+    assert err["Code"] == "InvalidRequestException"
+    assert "Account ID format specified in proposal is not valid" in err["Message"]
 
 
 @mock_managedblockchain
@@ -167,8 +156,8 @@ def test_create_proposal_badremovalmemid():
     with pytest.raises(ClientError) as ex:
         conn.create_proposal(NetworkId=network_id, MemberId=member_id, Actions=actions)
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain("Member ID format specified in proposal is not valid")
+    assert err["Code"] == "InvalidRequestException"
+    assert "Member ID format specified in proposal is not valid" in err["Message"]
 
 
 @mock_managedblockchain
@@ -178,8 +167,8 @@ def test_list_proposal_badnetwork():
     with pytest.raises(ClientError) as ex:
         conn.list_proposals(NetworkId="n-ABCDEFGHIJKLMNOP0123456789")
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -192,8 +181,8 @@ def test_get_proposal_badnetwork():
             ProposalId="p-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -201,20 +190,19 @@ def test_get_proposal_badproposal():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.get_proposal(
             NetworkId=network_id, ProposalId="p-ABCDEFGHIJKLMNOP0123456789"
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Proposal p-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Proposal p-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
diff --git a/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py b/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py
index 625b1d401..867b6a385 100644
--- a/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py
+++ b/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py
@@ -2,7 +2,6 @@ import os
 
 import boto3
 import pytest
-import sure  # noqa # pylint: disable=unused-import
 from botocore.exceptions import ClientError
 from freezegun import freeze_time
 from unittest import SkipTest
@@ -28,18 +27,17 @@ def test_vote_on_proposal_one_member_total_yes():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -48,14 +46,14 @@ def test_vote_on_proposal_one_member_total_yes():
 
     # List proposal votes
     response = conn.list_proposal_votes(NetworkId=network_id, ProposalId=proposal_id)
-    response["ProposalVotes"][0]["MemberId"].should.equal(member_id)
+    assert response["ProposalVotes"][0]["MemberId"] == member_id
 
     # Get proposal details - should be APPROVED
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["Status"].should.equal("APPROVED")
-    response["Proposal"]["YesVoteCount"].should.equal(1)
-    response["Proposal"]["NoVoteCount"].should.equal(0)
-    response["Proposal"]["OutstandingVoteCount"].should.equal(0)
+    assert response["Proposal"]["Status"] == "APPROVED"
+    assert response["Proposal"]["YesVoteCount"] == 1
+    assert response["Proposal"]["NoVoteCount"] == 0
+    assert response["Proposal"]["OutstandingVoteCount"] == 0
 
 
 @mock_managedblockchain
@@ -75,31 +73,30 @@ def test_vote_on_proposal_one_member_total_no():
     member_id = response["MemberId"]
 
     # Create proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote no
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id, ProposalId=proposal_id, VoterMemberId=member_id, Vote="NO"
     )
 
     # List proposal votes
     response = conn.list_proposal_votes(NetworkId=network_id, ProposalId=proposal_id)
-    response["ProposalVotes"][0]["MemberId"].should.equal(member_id)
+    assert response["ProposalVotes"][0]["MemberId"] == member_id
 
     # Get proposal details - should be REJECTED
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["Status"].should.equal("REJECTED")
-    response["Proposal"]["YesVoteCount"].should.equal(0)
-    response["Proposal"]["NoVoteCount"].should.equal(1)
-    response["Proposal"]["OutstandingVoteCount"].should.equal(0)
+    assert response["Proposal"]["Status"] == "REJECTED"
+    assert response["Proposal"]["YesVoteCount"] == 0
+    assert response["Proposal"]["NoVoteCount"] == 1
+    assert response["Proposal"]["OutstandingVoteCount"] == 0
 
 
 @mock_managedblockchain
@@ -126,14 +123,12 @@ def test_vote_on_proposal_yes_greater_than():
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
 
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -145,24 +140,21 @@ def test_vote_on_proposal_yes_greater_than():
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    member_id2 = conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
             "testmember2", "admin", "Admin12345", False, "Test Member 2"
         ),
-    )
-    member_id2 = response["MemberId"]
+    )["MemberId"]
 
     # Create another proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes with member 1
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -171,11 +163,11 @@ def test_vote_on_proposal_yes_greater_than():
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote no with member 2
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id2,
@@ -184,7 +176,7 @@ def test_vote_on_proposal_yes_greater_than():
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["Status"].should.equal("REJECTED")
+    assert response["Proposal"]["Status"] == "REJECTED"
 
 
 @mock_managedblockchain
@@ -211,14 +203,12 @@ def test_vote_on_proposal_no_greater_than():
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
 
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -230,29 +220,26 @@ def test_vote_on_proposal_no_greater_than():
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    member_id2 = conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
             "testmember2", "admin", "Admin12345", False, "Test Member 2"
         ),
-    )
-    member_id2 = response["MemberId"]
+    )["MemberId"]
 
     # Create another proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote no with member 1
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id, ProposalId=proposal_id, VoterMemberId=member_id, Vote="NO"
     )
 
     # Vote no with member 2
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id2,
@@ -261,8 +248,8 @@ def test_vote_on_proposal_no_greater_than():
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("REJECTED")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "REJECTED"
 
 
 @mock_managedblockchain
@@ -293,13 +280,11 @@ def test_vote_on_proposal_expiredproposal():
         network_id = response["NetworkId"]
         member_id = response["MemberId"]
 
-        response = conn.create_proposal(
+        proposal_id = conn.create_proposal(
             NetworkId=network_id,
             MemberId=member_id,
             Actions=helpers.default_policy_actions,
-        )
-
-        proposal_id = response["ProposalId"]
+        )["ProposalId"]
 
     with freeze_time("2015-02-01 12:00:00"):
         # Vote yes - should set status to expired
@@ -311,14 +296,15 @@ def test_vote_on_proposal_expiredproposal():
                 Vote="YES",
             )
         err = ex.value.response["Error"]
-        err["Code"].should.equal("InvalidRequestException")
-        err["Message"].should.contain(
+        assert err["Code"] == "InvalidRequestException"
+        assert (
             f"Proposal {proposal_id} is expired and you cannot vote on it."
+            in err["Message"]
         )
 
         # Get proposal details - should be EXPIRED
         response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-        response["Proposal"]["Status"].should.equal("EXPIRED")
+        assert response["Proposal"]["Status"] == "EXPIRED"
 
 
 @mock_managedblockchain
@@ -339,15 +325,14 @@ def test_vote_on_proposal_status_check():
 
     # Create 2 more members
     for counter in range(2, 4):
-        response = conn.create_proposal(
+        proposal_id = conn.create_proposal(
             NetworkId=network_id,
             MemberId=member_id,
             Actions=helpers.default_policy_actions,
-        )
-        proposal_id = response["ProposalId"]
+        )["ProposalId"]
 
         # Vote yes
-        response = conn.vote_on_proposal(
+        conn.vote_on_proposal(
             NetworkId=network_id,
             ProposalId=proposal_id,
             VoterMemberId=member_id,
@@ -364,7 +349,7 @@ def test_vote_on_proposal_status_check():
         )[0]
 
         # Create the member
-        response = conn.create_member(
+        member_id = conn.create_member(
             InvitationId=invitation_id,
             NetworkId=network_id,
             MemberConfiguration=helpers.create_member_configuration(
@@ -374,8 +359,7 @@ def test_vote_on_proposal_status_check():
                 False,
                 "Test Member " + str(counter),
             ),
-        )
-        member_id = response["MemberId"]
+        )["MemberId"]
         memberidlist[counter - 1] = member_id
 
     # Should be no more pending invitations
@@ -383,17 +367,15 @@ def test_vote_on_proposal_status_check():
     pendinginvs = helpers.select_invitation_id_for_network(
         response["Invitations"], network_id, "PENDING"
     )
-    pendinginvs.should.have.length_of(0)
+    assert len(pendinginvs) == 0
 
     # Create another proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Vote yes with member 1
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=memberidlist[0],
@@ -401,7 +383,7 @@ def test_vote_on_proposal_status_check():
     )
 
     # Vote yes with member 2
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=memberidlist[1],
@@ -410,15 +392,15 @@ def test_vote_on_proposal_status_check():
 
     # Get proposal details - now approved (2 yes, 1 outstanding)
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("APPROVED")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "APPROVED"
 
     # Should be one pending invitation
     response = conn.list_invitations()
     pendinginvs = helpers.select_invitation_id_for_network(
         response["Invitations"], network_id, "PENDING"
     )
-    pendinginvs.should.have.length_of(1)
+    assert len(pendinginvs) == 1
 
     # Vote with member 3 - should throw an exception and not create a new invitation
     with pytest.raises(ClientError) as ex:
@@ -429,15 +411,15 @@ def test_vote_on_proposal_status_check():
             Vote="YES",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("InvalidRequestException")
-    err["Message"].should.contain("and you cannot vote on it")
+    assert err["Code"] == "InvalidRequestException"
+    assert "and you cannot vote on it" in err["Message"]
 
     # Should still be one pending invitation
     response = conn.list_invitations()
     pendinginvs = helpers.select_invitation_id_for_network(
         response["Invitations"], network_id, "PENDING"
     )
-    pendinginvs.should.have.length_of(1)
+    assert len(pendinginvs) == 1
 
 
 @mock_managedblockchain
@@ -452,8 +434,8 @@ def test_vote_on_proposal_badnetwork():
             Vote="YES",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -461,15 +443,14 @@ def test_vote_on_proposal_badproposal():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network - need a good network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.vote_on_proposal(
@@ -479,8 +460,8 @@ def test_vote_on_proposal_badproposal():
             Vote="YES",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Proposal p-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Proposal p-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -499,11 +480,9 @@ def test_vote_on_proposal_badmember():
     network_id = response["NetworkId"]
     member_id = response["MemberId"]
 
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     with pytest.raises(ClientError) as ex:
         conn.vote_on_proposal(
@@ -513,8 +492,8 @@ def test_vote_on_proposal_badmember():
             Vote="YES",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Member m-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -547,8 +526,8 @@ def test_vote_on_proposal_badvote():
             Vote="FOO",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("BadRequestException")
-    err["Message"].should.contain("Invalid request body")
+    assert err["Code"] == "BadRequestException"
+    assert "Invalid request body" in err["Message"]
 
 
 @mock_managedblockchain
@@ -582,7 +561,7 @@ def test_vote_on_proposal_alreadyvoted():
     proposal_id = response["ProposalId"]
 
     # Vote yes
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -594,7 +573,7 @@ def test_vote_on_proposal_alreadyvoted():
     invitation_id = response["Invitations"][0]["InvitationId"]
 
     # Create the member
-    response = conn.create_member(
+    conn.create_member(
         InvitationId=invitation_id,
         NetworkId=network_id,
         MemberConfiguration=helpers.create_member_configuration(
@@ -603,19 +582,17 @@ def test_vote_on_proposal_alreadyvoted():
     )
 
     # Create another proposal
-    response = conn.create_proposal(
+    proposal_id = conn.create_proposal(
         NetworkId=network_id, MemberId=member_id, Actions=helpers.default_policy_actions
-    )
-
-    proposal_id = response["ProposalId"]
+    )["ProposalId"]
 
     # Get proposal details
     response = conn.get_proposal(NetworkId=network_id, ProposalId=proposal_id)
-    response["Proposal"]["NetworkId"].should.equal(network_id)
-    response["Proposal"]["Status"].should.equal("IN_PROGRESS")
+    assert response["Proposal"]["NetworkId"] == network_id
+    assert response["Proposal"]["Status"] == "IN_PROGRESS"
 
     # Vote yes with member 1
-    response = conn.vote_on_proposal(
+    conn.vote_on_proposal(
         NetworkId=network_id,
         ProposalId=proposal_id,
         VoterMemberId=member_id,
@@ -631,9 +608,10 @@ def test_vote_on_proposal_alreadyvoted():
             Vote="YES",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceAlreadyExistsException")
-    err["Message"].should.contain(
+    assert err["Code"] == "ResourceAlreadyExistsException"
+    assert (
         f"Member {member_id} has already voted on proposal {proposal_id}."
+        in err["Message"]
     )
 
 
@@ -647,8 +625,8 @@ def test_list_proposal_votes_badnetwork():
             ProposalId="p-ABCDEFGHIJKLMNOP0123456789",
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Network n-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
 
 
 @mock_managedblockchain
@@ -656,20 +634,19 @@ def test_list_proposal_votes_badproposal():
     conn = boto3.client("managedblockchain", region_name="us-east-1")
 
     # Create network
-    response = conn.create_network(
+    network_id = conn.create_network(
         Name="testnetwork1",
         Framework="HYPERLEDGER_FABRIC",
         FrameworkVersion="1.2",
         FrameworkConfiguration=helpers.default_frameworkconfiguration,
         VotingPolicy=helpers.default_votingpolicy,
         MemberConfiguration=helpers.default_memberconfiguration,
-    )
-    network_id = response["NetworkId"]
+    )["NetworkId"]
 
     with pytest.raises(ClientError) as ex:
         conn.list_proposal_votes(
             NetworkId=network_id, ProposalId="p-ABCDEFGHIJKLMNOP0123456789"
         )
     err = ex.value.response["Error"]
-    err["Code"].should.equal("ResourceNotFoundException")
-    err["Message"].should.contain("Proposal p-ABCDEFGHIJKLMNOP0123456789 not found")
+    assert err["Code"] == "ResourceNotFoundException"
+    assert "Proposal p-ABCDEFGHIJKLMNOP0123456789 not found" in err["Message"]
diff --git a/tests/test_scheduler/test_scheduler.py b/tests/test_scheduler/test_scheduler.py
index 9ff962a51..fea2ca458 100644
--- a/tests/test_scheduler/test_scheduler.py
+++ b/tests/test_scheduler/test_scheduler.py
@@ -144,6 +144,26 @@ def test_update_schedule(extra_kwargs):
     assert schedule["CreationDate"] != schedule["LastModificationDate"]
 
 
+@mock_scheduler
+def test_create_duplicate_schedule():
+    client = boto3.client("scheduler", region_name="us-east-1")
+    params = {
+        "ScheduleExpression": "at(2022-12-12T00:00:00)",
+        "FlexibleTimeWindow": {
+            "MaximumWindowInMinutes": 4,
+            "Mode": "FLEXIBLE",
+        },
+        "Target": {"Arn": "arn1", "RoleArn": "arn2"},
+    }
+
+    client.create_schedule(Name="schedule1", **params)
+    with pytest.raises(ClientError) as exc:
+        client.create_schedule(Name="schedule1", **params)
+    err = exc.value.response["Error"]
+    assert err["Code"] == "ConflictException"
+    assert err["Message"] == "Schedule schedule1 already exists."
+
+
 @mock_scheduler
 def test_get_schedule_for_unknown_group():
     client = boto3.client("scheduler", region_name="eu-west-1")