From owner-dev-commits-ports-main@freebsd.org Wed May 26 12:58:36 2021 Return-Path: Delivered-To: dev-commits-ports-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C424E63C183; Wed, 26 May 2021 12:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fqrbw4Y8Cz4t9c; Wed, 26 May 2021 12:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83A3B1125D; Wed, 26 May 2021 12:58:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14QCwa7q033255; Wed, 26 May 2021 12:58:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QCwabb033254; Wed, 26 May 2021 12:58:36 GMT (envelope-from git) Date: Wed, 26 May 2021 12:58:36 GMT Message-Id: <202105261258.14QCwabb033254@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Po-Chuan Hsieh Subject: git: 28d15b349ba7 - main - devel/py-moto: Update to 2.0.8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sunpoet X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28d15b349ba74a558ddc6877d2cb1f8a15029790 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the main branch of the FreeBSD ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 12:58:37 -0000 The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=28d15b349ba74a558ddc6877d2cb1f8a15029790 commit 28d15b349ba74a558ddc6877d2cb1f8a15029790 Author: Po-Chuan Hsieh AuthorDate: 2021-05-26 12:54:56 +0000 Commit: Po-Chuan Hsieh CommitDate: 2021-05-26 12:54:56 +0000 devel/py-moto: Update to 2.0.8 Changes: https://github.com/spulec/moto/blob/master/CHANGELOG.md --- devel/py-moto/Makefile | 5 +- devel/py-moto/distinfo | 6 +- devel/py-moto/files/patch-werkzeug | 1449 ------------------------------------ 3 files changed, 5 insertions(+), 1455 deletions(-) diff --git a/devel/py-moto/Makefile b/devel/py-moto/Makefile index 9a2a0cf271f6..4f071b4969c4 100644 --- a/devel/py-moto/Makefile +++ b/devel/py-moto/Makefile @@ -1,7 +1,7 @@ # Created by: Po-Chuan Hsieh PORTNAME= moto -PORTVERSION= 2.0.7 +PORTVERSION= 2.0.8 CATEGORIES= devel python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -24,8 +24,7 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}boto3>=1.9.201:www/py-boto3@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}responses>=0.9.0:devel/py-responses@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}six>=1.9:devel/py-six@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}werkzeug>=0:www/py-werkzeug@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}xmltodict>=0:devel/py-xmltodict@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}zipp>=0:devel/py-zipp@${PY_FLAVOR} + ${PYTHON_PKGNAMEPREFIX}xmltodict>=0:devel/py-xmltodict@${PY_FLAVOR} TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}aws-xray-sdk>=0:devel/py-aws-xray-sdk@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}boto>=0:devel/py-boto@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}docker>=0:sysutils/py-docker@${PY_FLAVOR} \ diff --git a/devel/py-moto/distinfo b/devel/py-moto/distinfo index 3cd834c10361..e35f2808df71 100644 --- a/devel/py-moto/distinfo +++ b/devel/py-moto/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1621183214 -SHA256 (moto-2.0.7.tar.gz) = 4209ee3241df1160523a58a169d31d0c8aa10b7aa75894484de58cbfacf14523 -SIZE (moto-2.0.7.tar.gz) = 1565849 +TIMESTAMP = 1621699717 +SHA256 (moto-2.0.8.tar.gz) = 812dcfdb460e6d43236f2c0f7774ede038716daef6db8a09dc5c16ea7e4de931 +SIZE (moto-2.0.8.tar.gz) = 1569426 diff --git a/devel/py-moto/files/patch-werkzeug b/devel/py-moto/files/patch-werkzeug deleted file mode 100644 index 2bb855e12f10..000000000000 --- a/devel/py-moto/files/patch-werkzeug +++ /dev/null @@ -1,1449 +0,0 @@ -Obtained from: https://github.com/spulec/moto/commit/9e3faf77844029649147471c930097c06bb13095 - ---- moto/managedblockchain/exceptions.py.orig 2021-05-12 08:03:14 UTC -+++ moto/managedblockchain/exceptions.py -@@ -1,9 +1,54 @@ - from __future__ import unicode_literals --from moto.core.exceptions import RESTError -+from functools import wraps -+from werkzeug.exceptions import HTTPException -+from jinja2 import DictLoader, Environment - - --class ManagedBlockchainClientError(RESTError): -+ERROR_JSON_RESPONSE = """{ -+ "message": "{{message}}" -+} -+""" -+ -+ -+def exception_handler(f): -+ @wraps(f) -+ def _wrapper(*args, **kwargs): -+ try: -+ return f(*args, **kwargs) -+ except ManagedBlockchainClientError as err: -+ return err.code, err.get_headers(), err.description -+ -+ return _wrapper -+ -+ -+class ManagedBlockchainClientError(HTTPException): - code = 400 -+ -+ templates = { -+ "error": ERROR_JSON_RESPONSE, -+ } -+ -+ def __init__(self, error_type, message, **kwargs): -+ super(HTTPException, self).__init__() -+ env = Environment(loader=DictLoader(self.templates)) -+ self.error_type = error_type -+ self.message = message -+ self.description = env.get_template("error").render( -+ error_type=error_type, message=message, **kwargs -+ ) -+ -+ def get_headers(self, *args, **kwargs): -+ return [ -+ ("Content-Type", "application/json"), -+ ("x-amzn-ErrorType", self.error_type), -+ ] -+ -+ @property -+ def response(self): -+ return self.get_body() -+ -+ def get_body(self, *args, **kwargs): -+ return self.description - - - class BadRequestException(ManagedBlockchainClientError): ---- moto/managedblockchain/responses.py.orig 2021-05-12 08:03:14 UTC -+++ moto/managedblockchain/responses.py -@@ -4,6 +4,7 @@ import json - from six.moves.urllib.parse import urlparse, parse_qs - - from moto.core.responses import BaseResponse -+from .exceptions import exception_handler - from .models import managedblockchain_backends - from .utils import ( - region_from_managedblckchain_url, -@@ -21,6 +22,7 @@ class ManagedBlockchainResponse(BaseResponse): - self.backend = backend - - @classmethod -+ @exception_handler - def network_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -73,6 +75,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, json.dumps(response) - - @classmethod -+ @exception_handler - def networkid_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -94,6 +97,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, response - - @classmethod -+ @exception_handler - def proposal_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -139,6 +143,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, json.dumps(response) - - @classmethod -+ @exception_handler - def proposalid_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -160,6 +165,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, response - - @classmethod -+ @exception_handler - def proposal_votes_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -203,6 +209,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, "" - - @classmethod -+ @exception_handler - def invitation_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -224,6 +231,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, response - - @classmethod -+ @exception_handler - def invitationid_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -243,6 +251,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, "" - - @classmethod -+ @exception_handler - def member_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -283,6 +292,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, json.dumps(response) - - @classmethod -+ @exception_handler - def memberid_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -327,6 +337,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, "" - - @classmethod -+ @exception_handler - def node_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( -@@ -380,6 +391,7 @@ class ManagedBlockchainResponse(BaseResponse): - return 200, headers, json.dumps(response) - - @classmethod -+ @exception_handler - def nodeid_response(clazz, request, full_url, headers): - region_name = region_from_managedblckchain_url(full_url) - response_instance = ManagedBlockchainResponse( ---- requirements-dev.txt.orig 2021-05-12 08:03:14 UTC -+++ requirements-dev.txt -@@ -7,7 +7,7 @@ coverage==4.5.4 - flake8==3.7.8 - boto>=2.45.0 - prompt-toolkit==2.0.10 # 3.x is not available with python2 --click==6.7 -+click - inflection==0.3.1 - lxml - packaging ---- setup.py.orig 2021-05-12 08:03:14 UTC -+++ setup.py -@@ -36,8 +36,7 @@ install_requires = [ - "requests>=2.5", - "xmltodict", - "six>1.9", -- # TODO: werkzeug 2.x currently breaks test_s3_server_post_without_content_length -- "werkzeug<2.0.0", -+ "werkzeug", - "pytz", - "python-dateutil<3.0.0,>=2.1", - "responses>=0.9.0", ---- tests/test_managedblockchain/test_managedblockchain_invitations.py.orig 2021-05-12 08:03:14 UTC -+++ tests/test_managedblockchain/test_managedblockchain_invitations.py -@@ -1,8 +1,10 @@ - from __future__ import unicode_literals - - import boto3 -+import pytest - import sure # noqa - -+from botocore.exceptions import ClientError - from moto import mock_managedblockchain - from . import helpers - -@@ -136,6 +138,10 @@ def test_reject_invitation_badinvitation(): - Vote="YES", - ) - -- response = conn.reject_invitation.when.called_with( -- InvitationId="in-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "InvitationId in-ABCDEFGHIJKLMNOP0123456789 not found.") -+ 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." -+ ) ---- tests/test_managedblockchain/test_managedblockchain_members.py.orig 2021-05-12 08:03:14 UTC -+++ tests/test_managedblockchain/test_managedblockchain_members.py -@@ -1,8 +1,10 @@ - from __future__ import unicode_literals - - import boto3 -+import pytest - import sure # noqa - -+from botocore.exceptions import ClientError, ParamValidationError - from moto import mock_managedblockchain - from . import helpers - -@@ -165,13 +167,17 @@ def test_create_another_member_withopts(): - response["Member"]["Description"].should.equal("Test Member 2") - - # Try to create member with already used invitation -- response = conn.create_member.when.called_with( -- InvitationId=invitation_id, -- NetworkId=network_id, -- MemberConfiguration=helpers.create_member_configuration( -- "testmember2", "admin", "Admin12345", False, "Test Member 2 Duplicate" -- ), -- ).should.throw(Exception, "Invitation {0} not valid".format(invitation_id)) -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ InvitationId=invitation_id, -+ NetworkId=network_id, -+ MemberConfiguration=helpers.create_member_configuration( -+ "testmember2", "admin", "Admin12345", False, "Test Member 2 Duplicate" -+ ), -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("InvalidRequestException") -+ err["Message"].should.contain("Invitation {0} not valid".format(invitation_id)) - - # Delete member 2 - conn.delete_member(NetworkId=network_id, MemberId=member_id2) -@@ -182,9 +188,11 @@ def test_create_another_member_withopts(): - members.should.have.length_of(2) - - # But cannot get -- response = conn.get_member.when.called_with( -- NetworkId=network_id, MemberId=member_id2, -- ).should.throw(Exception, "Member {0} not found".format(member_id2)) -+ 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("Member {0} not found".format(member_id2)) - - # Delete member 1 - conn.delete_member(NetworkId=network_id, MemberId=member_id) -@@ -362,13 +370,17 @@ def test_create_too_many_members(): - )[0] - - # Try to create one too many members -- response = conn.create_member.when.called_with( -- InvitationId=invitation_id, -- NetworkId=network_id, -- MemberConfiguration=helpers.create_member_configuration( -- "testmember6", "admin", "Admin12345", False, "Test Member 6" -- ), -- ).should.throw(Exception, "is the maximum number of members allowed in a",) -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ InvitationId=invitation_id, -+ NetworkId=network_id, -+ MemberConfiguration=helpers.create_member_configuration( -+ "testmember6", "admin", "Admin12345", False, "Test Member 6" -+ ), -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceLimitExceededException") -+ err["Message"].should.contain("is the maximum number of members allowed in a") - - - @mock_managedblockchain -@@ -409,17 +421,20 @@ def test_create_another_member_alreadyhave(): - invitation_id = response["Invitations"][0]["InvitationId"] - - # Should fail trying to create with same name -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId=invitation_id, -- MemberConfiguration=helpers.create_member_configuration( -- "testmember1", "admin", "Admin12345", False -- ), -- ).should.throw( -- Exception, -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId=invitation_id, -+ MemberConfiguration=helpers.create_member_configuration( -+ "testmember1", "admin", "Admin12345", False -+ ), -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("InvalidRequestException") -+ err["Message"].should.contain( - "Member name {0} already exists in network {1}".format( - "testmember1", network_id -- ), -+ ) - ) - - -@@ -427,13 +442,17 @@ def test_create_another_member_alreadyhave(): - def test_create_another_member_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.create_member.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- InvitationId="id-ABCDEFGHIJKLMNOP0123456789", -- MemberConfiguration=helpers.create_member_configuration( -- "testmember2", "admin", "Admin12345", False -- ), -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ InvitationId="id-ABCDEFGHIJKLMNOP0123456789", -+ MemberConfiguration=helpers.create_member_configuration( -+ "testmember2", "admin", "Admin12345", False -+ ), -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -451,13 +470,17 @@ def test_create_another_member_badinvitation(): - ) - network_id = response["NetworkId"] - -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId="in-ABCDEFGHIJKLMNOP0123456789", -- MemberConfiguration=helpers.create_member_configuration( -- "testmember2", "admin", "Admin12345", False -- ), -- ).should.throw(Exception, "Invitation in-ABCDEFGHIJKLMNOP0123456789 not valid") -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId="in-ABCDEFGHIJKLMNOP0123456789", -+ MemberConfiguration=helpers.create_member_configuration( -+ "testmember2", "admin", "Admin12345", False -+ ), -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("InvalidRequestException") -+ err["Message"].should.contain("Invitation in-ABCDEFGHIJKLMNOP0123456789 not valid") - - - @mock_managedblockchain -@@ -509,73 +532,97 @@ def test_create_another_member_adminpassword(): - badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][ - "AdminPassword" - ] = "badap" -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId=invitation_id, -- MemberConfiguration=badadminpassmemberconf, -- ).should.throw( -- Exception, -- "Invalid length for parameter MemberConfiguration.FrameworkConfiguration.Fabric.AdminPassword", -+ with pytest.raises(ParamValidationError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId=invitation_id, -+ MemberConfiguration=badadminpassmemberconf, -+ ) -+ err = ex.value -+ str(err).should.contain( -+ "Invalid length for parameter MemberConfiguration.FrameworkConfiguration.Fabric.AdminPassword" - ) - - # No uppercase or numbers - badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][ - "AdminPassword" - ] = "badadminpwd" -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId=invitation_id, -- MemberConfiguration=badadminpassmemberconf, -- ).should.throw(Exception, "Invalid request body") -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId=invitation_id, -+ MemberConfiguration=badadminpassmemberconf, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain("Invalid request body") - - # No lowercase or numbers - badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][ - "AdminPassword" - ] = "BADADMINPWD" -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId=invitation_id, -- MemberConfiguration=badadminpassmemberconf, -- ).should.throw(Exception, "Invalid request body") -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId=invitation_id, -+ MemberConfiguration=badadminpassmemberconf, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain("Invalid request body") - - # No numbers - badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][ - "AdminPassword" - ] = "badAdminpwd" -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId=invitation_id, -- MemberConfiguration=badadminpassmemberconf, -- ).should.throw(Exception, "Invalid request body") -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId=invitation_id, -+ MemberConfiguration=badadminpassmemberconf, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain("Invalid request body") - - # Invalid character - badadminpassmemberconf["FrameworkConfiguration"]["Fabric"][ - "AdminPassword" - ] = "badAdmin@pwd1" -- response = conn.create_member.when.called_with( -- NetworkId=network_id, -- InvitationId=invitation_id, -- MemberConfiguration=badadminpassmemberconf, -- ).should.throw(Exception, "Invalid request body") -+ with pytest.raises(ClientError) as ex: -+ conn.create_member( -+ NetworkId=network_id, -+ InvitationId=invitation_id, -+ MemberConfiguration=badadminpassmemberconf, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain("Invalid request body") - - - @mock_managedblockchain - def test_list_members_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.list_members.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ 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") - - - @mock_managedblockchain - def test_get_member_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.get_member.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.get_member( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -593,19 +640,25 @@ def test_get_member_badmember(): - ) - network_id = response["NetworkId"] - -- response = conn.get_member.when.called_with( -- NetworkId=network_id, MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Member m-ABCDEFGHIJKLMNOP0123456789 not found") -+ 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") - - - @mock_managedblockchain - def test_delete_member_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.delete_member.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.delete_member( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -623,22 +676,30 @@ def test_delete_member_badmember(): - ) - network_id = response["NetworkId"] - -- response = conn.delete_member.when.called_with( -- NetworkId=network_id, MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Member m-ABCDEFGHIJKLMNOP0123456789 not found") -+ 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") - - - @mock_managedblockchain - def test_update_member_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.update_member.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- LogPublishingConfiguration=helpers.default_memberconfiguration[ -- "LogPublishingConfiguration" -- ], -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.update_member( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ LogPublishingConfiguration=helpers.default_memberconfiguration[ -+ "LogPublishingConfiguration" -+ ], -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -656,10 +717,14 @@ def test_update_member_badmember(): - ) - network_id = response["NetworkId"] - -- response = conn.update_member.when.called_with( -- NetworkId=network_id, -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- LogPublishingConfiguration=helpers.default_memberconfiguration[ -- "LogPublishingConfiguration" -- ], -- ).should.throw(Exception, "Member m-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.update_member( -+ NetworkId=network_id, -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ LogPublishingConfiguration=helpers.default_memberconfiguration[ -+ "LogPublishingConfiguration" -+ ], -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found") ---- tests/test_managedblockchain/test_managedblockchain_networks.py.orig 2021-05-12 08:03:14 UTC -+++ tests/test_managedblockchain/test_managedblockchain_networks.py -@@ -1,8 +1,10 @@ - from __future__ import unicode_literals - - import boto3 -+import pytest - import sure # noqa - -+from botocore.exceptions import ClientError - from moto import mock_managedblockchain - from . import helpers - -@@ -68,31 +70,39 @@ def test_create_network_withopts(): - def test_create_network_noframework(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.create_network.when.called_with( -- Name="testnetwork1", -- Description="Test Network 1", -- Framework="HYPERLEDGER_VINYL", -- FrameworkVersion="1.2", -- FrameworkConfiguration=helpers.default_frameworkconfiguration, -- VotingPolicy=helpers.default_votingpolicy, -- MemberConfiguration=helpers.default_memberconfiguration, -- ).should.throw(Exception, "Invalid request body") -+ with pytest.raises(ClientError) as ex: -+ conn.create_network( -+ Name="testnetwork1", -+ Description="Test Network 1", -+ Framework="HYPERLEDGER_VINYL", -+ FrameworkVersion="1.2", -+ FrameworkConfiguration=helpers.default_frameworkconfiguration, -+ VotingPolicy=helpers.default_votingpolicy, -+ MemberConfiguration=helpers.default_memberconfiguration, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain("Invalid request body") - - - @mock_managedblockchain - def test_create_network_badframeworkver(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.create_network.when.called_with( -- Name="testnetwork1", -- Description="Test Network 1", -- Framework="HYPERLEDGER_FABRIC", -- FrameworkVersion="1.X", -- FrameworkConfiguration=helpers.default_frameworkconfiguration, -- VotingPolicy=helpers.default_votingpolicy, -- MemberConfiguration=helpers.default_memberconfiguration, -- ).should.throw( -- Exception, "Invalid version 1.X requested for framework HYPERLEDGER_FABRIC" -+ with pytest.raises(ClientError) as ex: -+ conn.create_network( -+ Name="testnetwork1", -+ Description="Test Network 1", -+ Framework="HYPERLEDGER_FABRIC", -+ FrameworkVersion="1.X", -+ FrameworkConfiguration=helpers.default_frameworkconfiguration, -+ VotingPolicy=helpers.default_votingpolicy, -+ MemberConfiguration=helpers.default_memberconfiguration, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain( -+ "Invalid version 1.X requested for framework HYPERLEDGER_FABRIC" - ) - - -@@ -102,21 +112,27 @@ def test_create_network_badedition(): - - frameworkconfiguration = {"Fabric": {"Edition": "SUPER"}} - -- response = conn.create_network.when.called_with( -- Name="testnetwork1", -- Description="Test Network 1", -- Framework="HYPERLEDGER_FABRIC", -- FrameworkVersion="1.2", -- FrameworkConfiguration=frameworkconfiguration, -- VotingPolicy=helpers.default_votingpolicy, -- MemberConfiguration=helpers.default_memberconfiguration, -- ).should.throw(Exception, "Invalid request body") -+ with pytest.raises(ClientError) as ex: -+ conn.create_network( -+ Name="testnetwork1", -+ Description="Test Network 1", -+ Framework="HYPERLEDGER_FABRIC", -+ FrameworkVersion="1.2", -+ FrameworkConfiguration=frameworkconfiguration, -+ VotingPolicy=helpers.default_votingpolicy, -+ MemberConfiguration=helpers.default_memberconfiguration, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("BadRequestException") -+ err["Message"].should.contain("Invalid request body") - - - @mock_managedblockchain - def test_get_network_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.get_network.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ 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") ---- tests/test_managedblockchain/test_managedblockchain_nodes.py.orig 2021-05-12 08:03:14 UTC -+++ tests/test_managedblockchain/test_managedblockchain_nodes.py -@@ -1,8 +1,10 @@ - from __future__ import unicode_literals - - import boto3 -+import pytest - import sure # noqa - -+from botocore.exceptions import ClientError - from moto import mock_managedblockchain - from . import helpers - -@@ -76,9 +78,11 @@ def test_create_node(): - helpers.node_id_exist_in_list(nodes, node_id).should.equal(True) - - # But cannot get -- response = conn.get_node.when.called_with( -- NetworkId=network_id, MemberId=member_id, NodeId=node_id, -- ).should.throw(Exception, "Node {0} not found".format(node_id)) -+ 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("Node {0} not found".format(node_id)) - - - @mock_managedblockchain -@@ -145,9 +149,11 @@ def test_create_node_standard_edition(): - conn.delete_member(NetworkId=network_id, MemberId=member_id) - - # Should now be an exception -- response = conn.list_nodes.when.called_with( -- NetworkId=network_id, MemberId=member_id, -- ).should.throw(Exception, "Member {0} not found".format(member_id)) -+ 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("Member {0} not found".format(member_id)) - - - @mock_managedblockchain -@@ -187,12 +193,16 @@ def test_create_too_many_nodes(): - nodes.should.have.length_of(2) - - # Try to create one too many nodes -- response = conn.create_node.when.called_with( -- NetworkId=network_id, -- MemberId=member_id, -- NodeConfiguration=helpers.default_nodeconfiguration, -- ).should.throw( -- Exception, "Maximum number of nodes exceeded in member {0}".format(member_id), -+ with pytest.raises(ClientError) as ex: -+ conn.create_node( -+ NetworkId=network_id, -+ MemberId=member_id, -+ NodeConfiguration=helpers.default_nodeconfiguration, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceLimitExceededException") -+ err["Message"].should.contain( -+ "Maximum number of nodes exceeded in member {0}".format(member_id) - ) - - -@@ -200,11 +210,15 @@ def test_create_too_many_nodes(): - def test_create_node_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.create_node.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- NodeConfiguration=helpers.default_nodeconfiguration, -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.create_node( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ NodeConfiguration=helpers.default_nodeconfiguration, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -222,11 +236,15 @@ def test_create_node_badmember(): - ) - network_id = response["NetworkId"] - -- response = conn.create_node.when.called_with( -- NetworkId=network_id, -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- NodeConfiguration=helpers.default_nodeconfiguration, -- ).should.throw(Exception, "Member m-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.create_node( -+ NetworkId=network_id, -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ NodeConfiguration=helpers.default_nodeconfiguration, -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -248,36 +266,51 @@ def test_create_node_badnodeconfig(): - # Incorrect instance type - logconfigbad = dict(helpers.default_nodeconfiguration) - logconfigbad["InstanceType"] = "foo" -- response = conn.create_node.when.called_with( -- NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad, -- ).should.throw(Exception, "Requested instance foo isn't supported.") -+ with pytest.raises(ClientError) as ex: -+ conn.create_node( -+ 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.") - - # Incorrect instance type for edition - logconfigbad = dict(helpers.default_nodeconfiguration) - logconfigbad["InstanceType"] = "bc.t3.large" -- response = conn.create_node.when.called_with( -- NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad, -- ).should.throw( -- Exception, -- "Instance type bc.t3.large is not supported with STARTER Edition networks", -+ with pytest.raises(ClientError) as ex: -+ conn.create_node( -+ NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("InvalidRequestException") -+ err["Message"].should.contain( -+ "Instance type bc.t3.large is not supported with STARTER Edition networks." - ) - - # Incorrect availability zone - logconfigbad = dict(helpers.default_nodeconfiguration) - logconfigbad["AvailabilityZone"] = "us-east-11" -- response = conn.create_node.when.called_with( -- NetworkId=network_id, MemberId=member_id, NodeConfiguration=logconfigbad, -- ).should.throw(Exception, "Availability Zone is not valid") -+ with pytest.raises(ClientError) as ex: -+ conn.create_node( -+ 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") - - - @mock_managedblockchain - def test_list_nodes_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.list_nodes.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.list_nodes( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -295,20 +328,28 @@ def test_list_nodes_badmember(): - ) - network_id = response["NetworkId"] - -- response = conn.list_nodes.when.called_with( -- NetworkId=network_id, MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Member m-ABCDEFGHIJKLMNOP0123456789 not found") -+ 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") - - - @mock_managedblockchain - def test_get_node_badnetwork(): - conn = boto3.client("managedblockchain", region_name="us-east-1") - -- response = conn.get_node.when.called_with( -- NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- NodeId="nd-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Network n-ABCDEFGHIJKLMNOP0123456789 not found") -+ with pytest.raises(ClientError) as ex: -+ conn.get_node( -+ NetworkId="n-ABCDEFGHIJKLMNOP0123456789", -+ MemberId="m-ABCDEFGHIJKLMNOP0123456789", -+ NodeId="nd-ABCDEFGHIJKLMNOP0123456789", -+ ) -+ err = ex.value.response["Error"] -+ err["Code"].should.equal("ResourceNotFoundException") -+ err["Message"].should.contain("Network n-ABCDEFGHIJKLMNOP0123456789 not found") - - - @mock_managedblockchain -@@ -326,11 +367,15 @@ def test_get_node_badmember(): - ) - network_id = response["NetworkId"] - -- response = conn.get_node.when.called_with( -- NetworkId=network_id, -- MemberId="m-ABCDEFGHIJKLMNOP0123456789", -- NodeId="nd-ABCDEFGHIJKLMNOP0123456789", -- ).should.throw(Exception, "Member m-ABCDEFGHIJKLMNOP0123456789 not found") *** 521 LINES SKIPPED ***