Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 2021 19:32:10 GMT
From:      Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 340b5df88cec - main - devel/py-moto: Update to 2.0.7
Message-ID:  <202105181932.14IJWAfl036493@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=340b5df88cec8766458f86c1b5e8e569916ef71c

commit 340b5df88cec8766458f86c1b5e8e569916ef71c
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2021-05-18 19:28:19 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2021-05-18 19:28:19 +0000

    devel/py-moto: Update to 2.0.7
    
    Changes:        https://github.com/spulec/moto/blob/master/CHANGELOG.md
---
 devel/py-moto/Makefile             |    2 +-
 devel/py-moto/distinfo             |    6 +-
 devel/py-moto/files/patch-werkzeug | 1449 ++++++++++++++++++++++++++++++++++++
 3 files changed, 1453 insertions(+), 4 deletions(-)

diff --git a/devel/py-moto/Makefile b/devel/py-moto/Makefile
index 24269b9c9fcf..9a2a0cf271f6 100644
--- a/devel/py-moto/Makefile
+++ b/devel/py-moto/Makefile
@@ -1,7 +1,7 @@
 # Created by: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
 
 PORTNAME=	moto
-PORTVERSION=	2.0.6
+PORTVERSION=	2.0.7
 CATEGORIES=	devel python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-moto/distinfo b/devel/py-moto/distinfo
index b89448fb21d0..3cd834c10361 100644
--- a/devel/py-moto/distinfo
+++ b/devel/py-moto/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1620405413
-SHA256 (moto-2.0.6.tar.gz) = 7982176837406cabb47a84785125d337b6df357ae92ae29423724d072764dd90
-SIZE (moto-2.0.6.tar.gz) = 1557871
+TIMESTAMP = 1621183214
+SHA256 (moto-2.0.7.tar.gz) = 4209ee3241df1160523a58a169d31d0c8aa10b7aa75894484de58cbfacf14523
+SIZE (moto-2.0.7.tar.gz) = 1565849
diff --git a/devel/py-moto/files/patch-werkzeug b/devel/py-moto/files/patch-werkzeug
new file mode 100644
index 000000000000..2bb855e12f10
--- /dev/null
+++ b/devel/py-moto/files/patch-werkzeug
@@ -0,0 +1,1449 @@
+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")
++    with pytest.raises(ClientError) as ex:
++        conn.get_node(
++            NetworkId=network_id,
++            MemberId="m-ABCDEFGHIJKLMNOP0123456789",
++            NodeId="nd-ABCDEFGHIJKLMNOP0123456789",
++        )
++    err = ex.value.response["Error"]
++    err["Code"].should.equal("ResourceNotFoundException")
++    err["Message"].should.contain("Member m-ABCDEFGHIJKLMNOP0123456789 not found")
+ 
*** 511 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105181932.14IJWAfl036493>