diff --git a/aries_cloudagent/messaging/models/base_record.py b/aries_cloudagent/messaging/models/base_record.py index 3e94c58a5c..9ebbf74ff6 100644 --- a/aries_cloudagent/messaging/models/base_record.py +++ b/aries_cloudagent/messaging/models/base_record.py @@ -81,11 +81,11 @@ class Meta: def __init__( self, - id: str = None, - state: str = None, + id: Optional[str] = None, + state: Optional[str] = None, *, - created_at: Union[str, datetime] = None, - updated_at: Union[str, datetime] = None, + created_at: Union[str, datetime, None] = None, + updated_at: Union[str, datetime, None] = None, new_with_id: bool = False, ): """Initialize a new BaseRecord.""" diff --git a/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py b/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py index fbd3a8f6fe..b881d2fd34 100644 --- a/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py +++ b/aries_cloudagent/protocols/connections/v1_0/tests/test_manager.py @@ -463,6 +463,7 @@ async def test_create_request_multitenant(self): async def test_create_request_mediation_id(self): mediation_record = MediationRecord( + mediation_id="test_medation_id", role=MediationRecord.ROLE_CLIENT, state=MediationRecord.STATE_GRANTED, connection_id=self.test_mediator_conn_id, @@ -866,6 +867,7 @@ async def test_create_response_multitenant(self): ) mediation_record = MediationRecord( + mediation_id="test_medation_id", role=MediationRecord.ROLE_CLIENT, state=MediationRecord.STATE_GRANTED, connection_id=self.test_mediator_conn_id, @@ -936,6 +938,7 @@ async def test_create_response_bad_state(self): async def test_create_response_mediation(self): mediation_record = MediationRecord( + mediation_id="test_medation_id", role=MediationRecord.ROLE_CLIENT, state=MediationRecord.STATE_GRANTED, connection_id=self.test_mediator_conn_id, diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py index 86471117d0..08a8b42c97 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/handlers/tests/test_mediation_deny_handler.py @@ -11,8 +11,6 @@ from ..mediation_deny_handler import MediationDenyHandler TEST_CONN_ID = "conn-id" -TEST_MEDIATOR_TERMS = ["test", "mediator", "terms"] -TEST_RECIPIENT_TERMS = ["test", "recipient", "terms"] class TestMediationDenyHandler(AsyncTestCase): @@ -22,9 +20,7 @@ async def setUp(self): """Setup test dependencies.""" self.context = RequestContext.test_context() self.session = await self.context.session() - self.context.message = MediationDeny( - mediator_terms=TEST_MEDIATOR_TERMS, recipient_terms=TEST_RECIPIENT_TERMS - ) + self.context.message = MediationDeny() self.context.connection_ready = True self.context.connection_record = ConnRecord(connection_id=TEST_CONN_ID) @@ -50,5 +46,3 @@ async def test_handler(self): ) assert record assert record.state == MediationRecord.STATE_DENIED - assert record.mediator_terms == TEST_MEDIATOR_TERMS - assert record.recipient_terms == TEST_RECIPIENT_TERMS diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py index 8a5a1143ec..0ab45b1434 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py @@ -139,11 +139,8 @@ async def receive_request( "MediationRecord already exists for connection" ) - # TODO: Determine if terms are acceptable record = MediationRecord( connection_id=connection_id, - mediator_terms=request.mediator_terms, - recipient_terms=request.recipient_terms, ) await record.save(session, reason="New mediation request received") return record @@ -186,19 +183,11 @@ async def grant_request( async def deny_request( self, mediation_id: str, - *, - mediator_terms: Sequence[str] = None, - recipient_terms: Sequence[str] = None, ) -> Tuple[MediationRecord, MediationDeny]: """Deny a mediation request and prepare a deny message. Args: mediation_id: mediation record ID to deny - mediator_terms (Sequence[str]): updated mediator terms to return to - requester. - recipient_terms (Sequence[str]): updated recipient terms to return to - requester. - Returns: MediationDeny: message to return to denied client. @@ -215,9 +204,7 @@ async def deny_request( mediation_record.state = MediationRecord.STATE_DENIED await mediation_record.save(session, reason="Mediation request denied") - deny = MediationDeny( - mediator_terms=mediator_terms, recipient_terms=recipient_terms - ) + deny = MediationDeny() return mediation_record, deny async def _handle_keylist_update_add( @@ -442,15 +429,11 @@ async def clear_default_mediator(self): async def prepare_request( self, connection_id: str, - mediator_terms: Sequence[str] = None, - recipient_terms: Sequence[str] = None, ) -> Tuple[MediationRecord, MediationRequest]: """Prepare a MediationRequest Message, saving a new mediation record. Args: connection_id (str): ID representing mediator - mediator_terms (Sequence[str]): mediator_terms - recipient_terms (Sequence[str]): recipient_terms Returns: MediationRequest: message to send to mediator @@ -459,15 +442,11 @@ async def prepare_request( record = MediationRecord( role=MediationRecord.ROLE_CLIENT, connection_id=connection_id, - mediator_terms=mediator_terms, - recipient_terms=recipient_terms, ) async with self._profile.session() as session: await record.save(session, reason="Creating new mediation request.") - request = MediationRequest( - mediator_terms=mediator_terms, recipient_terms=recipient_terms - ) + request = MediationRequest() return record, request async def request_granted(self, record: MediationRecord, grant: MediationGrant): @@ -495,9 +474,6 @@ async def request_denied(self, record: MediationRecord, deny: MediationDeny): """ record.state = MediationRecord.STATE_DENIED - # TODO Record terms elsewhere? - record.mediator_terms = deny.mediator_terms - record.recipient_terms = deny.recipient_terms async with self._profile.session() as session: await record.save(session, reason="Mediation request denied.") diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py index bd6496ab63..b37f58dba7 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_deny.py @@ -1,8 +1,5 @@ """mediate-deny message used to notify mediation client of a denied mediation request.""" -from typing import Sequence - -from marshmallow import fields from .....messaging.agent_message import AgentMessage, AgentMessageSchema from ..message_types import MEDIATE_DENY, PROTOCOL_PACKAGE @@ -24,20 +21,10 @@ class Meta: def __init__( self, - *, - mediator_terms: Sequence[str] = None, - recipient_terms: Sequence[str] = None, **kwargs, ): - """Initialize mediation deny object. - - Args: - mediator_terms: Terms that were agreed by the recipient - recipient_terms: Terms that recipient wants to mediator to agree to - """ + """Initialize mediation deny object.""" super(MediationDeny, self).__init__(**kwargs) - self.mediator_terms = list(mediator_terms) if mediator_terms else [] - self.recipient_terms = list(recipient_terms) if recipient_terms else [] class MediationDenySchema(AgentMessageSchema): @@ -47,12 +34,3 @@ class Meta: """Mediation deny schema metadata.""" model_class = MediationDeny - - mediator_terms = fields.List( - fields.Str(metadata={"description": "Terms for mediator to agree"}), - required=False, - ) - recipient_terms = fields.List( - fields.Str(metadata={"description": "Terms for recipient to agree"}), - required=False, - ) diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_grant.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_grant.py index 587f61730a..d2595ede53 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_grant.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_grant.py @@ -3,7 +3,7 @@ Used to notify mediation client of a granted mediation request. """ -from typing import Sequence +from typing import Optional, Sequence from marshmallow import fields @@ -29,8 +29,8 @@ class Meta: def __init__( self, *, - endpoint: str = None, - routing_keys: Sequence[str] = None, + endpoint: Optional[str] = None, + routing_keys: Optional[Sequence[str]] = None, **kwargs, ): """Initialize mediation grant object. diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py index 84417ab830..2d47dc45eb 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/mediate_request.py @@ -1,8 +1,5 @@ """mediate-request message used to request mediation from a mediator.""" -from typing import Sequence - -from marshmallow import fields from .....messaging.agent_message import AgentMessage, AgentMessageSchema from ..message_types import MEDIATE_REQUEST, PROTOCOL_PACKAGE @@ -22,22 +19,9 @@ class Meta: message_type = MEDIATE_REQUEST schema_class = "MediationRequestSchema" - def __init__( - self, - *, - mediator_terms: Sequence[str] = None, - recipient_terms: Sequence[str] = None, - **kwargs, - ): - """Initialize mediation request object. - - Args: - mediator_terms: Mediator's terms for granting mediation. - recipient_terms: Recipient's proposed mediation terms. - """ + def __init__(self, **kwargs): + """Initialize mediation request object.""" super(MediationRequest, self).__init__(**kwargs) - self.mediator_terms = list(mediator_terms) if mediator_terms else [] - self.recipient_terms = list(recipient_terms) if recipient_terms else [] class MediationRequestSchema(AgentMessageSchema): @@ -47,27 +31,3 @@ class Meta: """Mediation request schema metadata.""" model_class = MediationRequest - - mediator_terms = fields.List( - fields.Str( - metadata={ - "description": ( - "Indicate terms that the mediator requires the recipient to" - " agree to" - ) - } - ), - required=False, - metadata={"description": "List of mediator rules for recipient"}, - ) - recipient_terms = fields.List( - fields.Str( - metadata={ - "description": ( - "Indicate terms that the recipient requires the mediator to" - " agree to" - ) - } - ), - required=False, - ) diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py index 5b82e5430e..bff806b0ed 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_deny.py @@ -12,4 +12,4 @@ class TestMediateDeny(MessageTest, TestCase): TYPE = MEDIATE_DENY CLASS = MediationDeny SCHEMA = MediationDenySchema - VALUES = {"mediator_terms": ["test", "terms"], "recipient_terms": ["test", "terms"]} + VALUES = {} diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py index fa99cf71b9..bb9ee0713b 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/messages/tests/test_mediate_request.py @@ -12,4 +12,4 @@ class TestMediateRequest(MessageTest, TestCase): TYPE = MEDIATE_REQUEST CLASS = MediationRequest SCHEMA = MediationRequestSchema - VALUES = {"mediator_terms": ["test", "terms"], "recipient_terms": ["test", "terms"]} + VALUES = {} diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/mediation_record.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/mediation_record.py index 6e3af3c726..f616864a47 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/mediation_record.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/mediation_record.py @@ -1,6 +1,6 @@ """Store state for Mediation requests.""" -from typing import Sequence +from typing import Optional, Sequence from marshmallow import EXCLUDE, fields @@ -33,14 +33,15 @@ class Meta: def __init__( self, *, - mediation_id: str = None, - state: str = None, - role: str = None, - connection_id: str = None, - mediator_terms: Sequence[str] = None, - recipient_terms: Sequence[str] = None, - routing_keys: Sequence[str] = None, - endpoint: str = None, + mediation_id: Optional[str] = None, + state: Optional[str] = None, + role: Optional[str] = None, + connection_id: Optional[str] = None, + routing_keys: Optional[Sequence[str]] = None, + endpoint: Optional[str] = None, + # Included for record backwards compat + mediator_terms: Optional[Sequence[str]] = None, + recipient_terms: Optional[Sequence[str]] = None, **kwargs, ): """__init__. @@ -50,8 +51,6 @@ def __init__( state (str): state, defaults to 'request_received' role (str): role in mediation, defaults to 'server' connection_id (str): ID of connection requesting or managing mediation - mediator_terms (Sequence[str]): mediator_terms - recipient_terms (Sequence[str]): recipient_terms routing_keys (Sequence[str]): keys in mediator control used to receive incoming messages endpoint (str): mediators endpoint @@ -61,8 +60,6 @@ def __init__( super().__init__(mediation_id, state or self.STATE_REQUEST, **kwargs) self.role = role if role else self.ROLE_SERVER self.connection_id = connection_id - self.mediator_terms = list(mediator_terms) if mediator_terms else [] - self.recipient_terms = list(recipient_terms) if recipient_terms else [] self.routing_keys = list(routing_keys) if routing_keys else [] self.endpoint = endpoint @@ -79,6 +76,8 @@ def __eq__(self, other: "MediationRecord"): @property def mediation_id(self) -> str: """Get Mediation ID.""" + if not self._id: + raise ValueError("Record not yet stored") return self._id @property @@ -109,8 +108,6 @@ def record_value(self) -> dict: return { prop: getattr(self, prop) for prop in ( - "mediator_terms", - "recipient_terms", "routing_keys", "endpoint", ) @@ -170,10 +167,12 @@ class Meta: mediation_id = fields.Str(required=False) role = fields.Str(required=True) connection_id = fields.Str(required=True) - mediator_terms = fields.List(fields.Str(), required=False) - recipient_terms = fields.List(fields.Str(), required=False) routing_keys = fields.List( fields.Str(validate=DID_KEY_VALIDATE, metadata={"example": DID_KEY_EXAMPLE}), required=False, ) endpoint = fields.Str(required=False) + + # Included for backwards compat with old records + mediator_terms = fields.List(fields.Str(), required=False) + recipient_terms = fields.List(fields.Str(), required=False) diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/__init__.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/__init__.py new file mode 100644 index 0000000000..7c3c4e3c4d --- /dev/null +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for models.""" diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py new file mode 100644 index 0000000000..546f1f2128 --- /dev/null +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py @@ -0,0 +1,62 @@ +"""Test mediation record.""" +import json + +import pytest + +from ......core.in_memory import InMemoryProfile +from ......core.profile import ProfileSession +from ......storage.base import BaseStorage +from ......storage.record import StorageRecord +from ..mediation_record import MediationRecord + + +@pytest.fixture() +async def session(): + profile = InMemoryProfile.test_profile() + async with profile.session() as session: + yield session + + +@pytest.mark.asyncio +async def test_backwards_compat_terms(session: ProfileSession): + """Make sure old records can be loaded still.""" + + old_record = StorageRecord( + MediationRecord.RECORD_TYPE, + id="test_mediation_id", + value=json.dumps( + { + "state": "granted", + "mediator_terms": ["dummy_terms"], + "recipient_terms": ["dummy_terms"], + } + ), + ) + storage = session.inject(BaseStorage) + await storage.add_record(old_record) + + record = await MediationRecord.retrieve_by_id(session, old_record.id) + assert isinstance(record, MediationRecord) + assert record.mediation_id == "test_mediation_id" + assert record.state == "granted" + + +@pytest.mark.asyncio +async def test_mediation_record_eq(): + record_0 = MediationRecord(mediation_id="test_medation_id_0", endpoint="zero") + record_1 = MediationRecord(mediation_id="test_medation_id_1", endpoint="one") + assert record_0 != record_1 + + with pytest.raises(ValueError): + record_0.state = "bad state" + + +@pytest.mark.asyncio +async def test_mediation_record_duplicate_means_exists(session: ProfileSession): + await MediationRecord(connection_id="test_connection_id", endpoint="abc").save( + session + ) + await MediationRecord(connection_id="test_connection_id", endpoint="def").save( + session + ) + assert await MediationRecord.exists_for_connection_id(session, "test_connection_id") diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/routes.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/routes.py index 82e04faabc..52b87058fd 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/routes.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/routes.py @@ -62,32 +62,6 @@ ) -MEDIATOR_TERMS_SCHEMA = fields.List( - fields.Str( - metadata={ - "description": ( - "Indicate terms to which the mediator requires the recipient to agree" - ) - } - ), - required=False, - metadata={"description": "List of mediator rules for recipient"}, -) - - -RECIPIENT_TERMS_SCHEMA = fields.List( - fields.Str( - metadata={ - "description": ( - "Indicate terms to which the recipient requires the mediator to agree" - ) - } - ), - required=False, - metadata={"description": "List of recipient rules for mediation"}, -) - - class MediationListSchema(OpenAPISchema): """Result schema for mediation list query.""" @@ -101,24 +75,16 @@ class MediationListQueryStringSchema(OpenAPISchema): """Parameters and validators for mediation record list request query string.""" conn_id = CONNECTION_ID_SCHEMA - mediator_terms = MEDIATOR_TERMS_SCHEMA - recipient_terms = RECIPIENT_TERMS_SCHEMA state = MEDIATION_STATE_SCHEMA class MediationCreateRequestSchema(OpenAPISchema): """Parameters and validators for create Mediation request query string.""" - mediator_terms = MEDIATOR_TERMS_SCHEMA - recipient_terms = RECIPIENT_TERMS_SCHEMA - class AdminMediationDenySchema(OpenAPISchema): """Parameters and validators for Mediation deny admin request query string.""" - mediator_terms = MEDIATOR_TERMS_SCHEMA - recipient_terms = RECIPIENT_TERMS_SCHEMA - class MediationIdMatchInfoSchema(OpenAPISchema): """Path parameters and validators for request taking mediation request id.""" @@ -281,10 +247,6 @@ async def request_mediation(request: web.BaseRequest): conn_id = request.match_info["conn_id"] - body = await request.json() - mediator_terms = body.get("mediator_terms") - recipient_terms = body.get("recipient_terms") - try: async with profile.session() as session: connection_record = await ConnRecord.retrieve_by_id(session, conn_id) @@ -300,11 +262,7 @@ async def request_mediation(request: web.BaseRequest): mediation_record, mediation_request = await MediationManager( profile - ).prepare_request( - connection_id=conn_id, - mediator_terms=mediator_terms, - recipient_terms=recipient_terms, - ) + ).prepare_request(connection_id=conn_id) result = mediation_record.serialize() except StorageNotFoundError as err: @@ -348,15 +306,10 @@ async def mediation_request_deny(request: web.BaseRequest): context: AdminRequestContext = request["context"] outbound_handler = request["outbound_message_router"] mediation_id = request.match_info.get("mediation_id") - body = await request.json() - mediator_terms = body.get("mediator_terms") - recipient_terms = body.get("recipient_terms") try: mediation_manager = MediationManager(context.profile) record, deny_request = await mediation_manager.deny_request( mediation_id=mediation_id, - mediator_terms=mediator_terms, - recipient_terms=recipient_terms, ) result = record.serialize() except StorageNotFoundError as err: diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py index 5ccab85c5f..188f600c99 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_mediation_manager.py @@ -130,8 +130,6 @@ async def test_deny_request(self, manager): record = await manager.receive_request(TEST_CONN_ID, request) assert record.connection_id == TEST_CONN_ID record, deny = await manager.deny_request(record.mediation_id) - assert deny.mediator_terms == [] - assert deny.recipient_terms == [] async def test_update_keylist_delete(self, session, manager, record): """test_update_keylist_delete.""" @@ -216,20 +214,6 @@ async def test_get_keylist_no_granted_record(self, manager): with pytest.raises(MediationNotGrantedError): await manager.get_keylist(record) - async def test_mediation_record_eq(self): - record_0 = MediationRecord(endpoint="zero") - record_1 = MediationRecord(endpoint="one") - assert record_0 != record_1 - assert record_0 != ValueError("not a mediation record") - - with pytest.raises(ValueError): - record_0.state = "bad state" - - async def test_mediation_record_duplicate_means_exists(self, session): - await MediationRecord(connection_id=TEST_CONN_ID, endpoint="abc").save(session) - await MediationRecord(connection_id=TEST_CONN_ID, endpoint="def").save(session) - assert await MediationRecord.exists_for_connection_id(session, TEST_CONN_ID) - async def test_create_keylist_query_response(self, session, manager, record): """test_create_keylist_query_response.""" await RouteRecord(connection_id=TEST_CONN_ID, recipient_key=TEST_VERKEY).save( diff --git a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_routes.py b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_routes.py index ababf0ea16..d4b3a83c99 100644 --- a/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_routes.py +++ b/aries_cloudagent/protocols/coordinate_mediation/v1_0/tests/test_routes.py @@ -33,8 +33,6 @@ def setUp(self): "state": "granted", "role": "server", "connection_id": "c3dd00cf-f6a2-4ddf-93d8-49ae74bdacef", - "mediator_terms": [], - "recipient_terms": [], "routing_keys": ["EwUKjVLboiLSuoWSEtDvrgrd41EUxG5bLecQrkHB63Up"], "endpoint": "http://192.168.1.13:3005", "created_at": "1234567890", @@ -212,10 +210,7 @@ async def test_delete_mediation_request_x_storage_error(self): await test_module.delete_mediation_request(self.request) async def test_request_mediation(self): - body = { - "mediator_terms": ["meaningless string because terms are not used"], - "recipient_terms": ["meaningless string because terms are not a 'thing'"], - } + body = {} self.request.json.return_value = body with async_mock.patch.object( test_module, "MediationManager", autospec=True @@ -243,10 +238,7 @@ async def test_request_mediation(self): self.outbound_message_router.assert_called() async def test_request_mediation_x_conn_not_ready(self): - body = { - "mediator_terms": ["meaningless string because terms are not used"], - "recipient_terms": ["meaningless string because terms are not a 'thing'"], - } + body = {} self.request.json.return_value = body with async_mock.patch.object( test_module.ConnRecord, @@ -259,10 +251,7 @@ async def test_request_mediation_x_conn_not_ready(self): assert "request connection is not ready" in exc.msg async def test_request_mediation_x_already_exists(self): - body = { - "mediator_terms": ["meaningless string because terms are not used"], - "recipient_terms": ["meaningless string because terms are not a 'thing'"], - } + body = {} self.request.json.return_value = body with async_mock.patch.object( test_module.ConnRecord, "retrieve_by_id", async_mock.CoroutineMock() @@ -277,10 +266,7 @@ async def test_request_mediation_x_already_exists(self): assert "already exists for connection" in exc.msg async def test_request_mediation_x_conn_not_found(self): - body = { - "mediator_terms": ["meaningless string because terms are not used"], - "recipient_terms": ["meaningless string because terms are not a 'thing'"], - } + body = {} self.request.json.return_value = body with async_mock.patch.object( test_module.ConnRecord, @@ -292,10 +278,7 @@ async def test_request_mediation_x_conn_not_found(self): await test_module.request_mediation(self.request) async def test_request_mediation_x_storage_error(self): - body = { - "mediator_terms": ["meaningless string because terms are not used"], - "recipient_terms": ["meaningless string because terms are not a 'thing'"], - } + body = {} self.request.json.return_value = body with async_mock.patch.object( test_module.ConnRecord,