Skip to content

Commit

Permalink
Fix transport inbound tests
Browse files Browse the repository at this point in the history
Signed-off-by: jamshale <[email protected]>
  • Loading branch information
jamshale committed Oct 29, 2024
1 parent a121148 commit 4866bd7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 7 additions & 5 deletions acapy_agent/transport/inbound/tests/test_http_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@


class TestHttpTransport(AioHTTPTestCase):
def setUp(self):
async def asyncSetUp(self):
self.message_results = []
self.port = unused_port()
self.profile = await create_test_profile()
self.session = None
self.transport = HttpTransport(
"0.0.0.0", self.port, self.create_session, max_message_size=65535
Expand All @@ -28,7 +29,10 @@ def setUp(self):
assert not self.transport.wire_format.get_recipient_keys(None) # cover method
self.result_event = None
self.response_message = None
super().setUp()
await super().asyncSetUp()

def get_profile(self):
return self.profile

def create_session(
self,
Expand All @@ -41,7 +45,7 @@ def create_session(
):
if not self.session:
session = InboundSession(
profile=mock.MagicMock(),
profile=self.get_profile(),
can_respond=can_respond,
inbound_handler=self.receive_message,
session_id=None,
Expand Down Expand Up @@ -78,7 +82,6 @@ async def test_start_x(self):
with pytest.raises(test_module.InboundTransportSetupError):
await self.transport.start()

@pytest.mark.skip(reason="Need to fix")
async def test_send_message(self):
await self.transport.start()

Expand All @@ -93,7 +96,6 @@ async def test_send_message(self):

await self.transport.stop()

@pytest.mark.skip(reason="Need to fix")
async def test_send_receive_message(self):
await self.transport.start()

Expand Down
20 changes: 9 additions & 11 deletions acapy_agent/transport/inbound/tests/test_ws_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ async def asyncSetUp(self):
self.message_results = []
self.port = unused_port()
self.session = None
self.root_profile = await create_test_profile()
self.profile = await create_test_profile()
self.transport = WsTransport(
"0.0.0.0",
self.port,
self.create_session,
root_profile=self.root_profile,
"0.0.0.0", self.port, self.create_session, root_profile=self.profile
)
self.transport.wire_format = JsonWireFormat()
self.result_event = None

await super().asyncSetUp()

async def create_session(
def get_profile(self):
return self.profile

def create_session(
self,
transport_type,
*,
Expand All @@ -44,7 +43,7 @@ async def create_session(
):
if not self.session:
session = InboundSession(
profile=self.root_profile,
profile=self.get_profile(),
can_respond=can_respond,
inbound_handler=self.receive_message,
session_id=None,
Expand All @@ -57,8 +56,8 @@ async def create_session(
result.set_result(self.session)
return result

async def get_application(self):
return await self.transport.make_application()
def get_application(self):
return self.transport.make_application()

def receive_message(
self,
Expand All @@ -78,7 +77,6 @@ async def test_start_x(self):
with pytest.raises(test_module.InboundTransportSetupError):
await self.transport.start()

@pytest.mark.skip(reason="Need to fix")
async def test_message_and_response(self):
await self.transport.start()

Expand Down

0 comments on commit 4866bd7

Please sign in to comment.