Skip to content

Commit

Permalink
Merge pull request #1606 from globalid/feat-IDENT-4048-update-web-ser…
Browse files Browse the repository at this point in the history
…ver-dependency

Update aiohttp dependency
  • Loading branch information
andrewwhitehead committed Jan 24, 2022
2 parents 919fdfc + 03cca99 commit cd5e63c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def receive_message(
def get_application(self):
return self.transport.make_application()

@unittest_run_loop
async def test_start_x(self):
with async_mock.patch.object(
test_module.web, "TCPSite", async_mock.MagicMock()
Expand All @@ -82,7 +81,6 @@ async def test_start_x(self):
with pytest.raises(test_module.InboundTransportSetupError):
await self.transport.start()

@unittest_run_loop
async def test_send_message(self):
await self.transport.start()

Expand All @@ -97,7 +95,6 @@ async def test_send_message(self):

await self.transport.stop()

@unittest_run_loop
async def test_send_receive_message(self):
await self.transport.start()

Expand All @@ -112,7 +109,6 @@ async def test_send_receive_message(self):

await self.transport.stop()

@unittest_run_loop
async def test_send_message_outliers(self):
await self.transport.start()

Expand Down Expand Up @@ -149,7 +145,6 @@ async def test_send_message_outliers(self):

await self.transport.stop()

@unittest_run_loop
async def test_invite_message_handler(self):
await self.transport.start()

Expand Down
2 changes: 0 additions & 2 deletions aries_cloudagent/transport/inbound/tests/test_ws_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def receive_message(
if self.result_event:
self.result_event.set()

@unittest_run_loop
async def test_start_x(self):
with async_mock.patch.object(
test_module.web, "TCPSite", async_mock.MagicMock()
Expand All @@ -78,7 +77,6 @@ async def test_start_x(self):
with pytest.raises(test_module.InboundTransportSetupError):
await self.transport.start()

@unittest_run_loop
async def test_message_and_response(self):
await self.transport.start()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def setUpAsync(self):
self.profile = InMemoryProfile.test_profile()
self.message_results = []
self.headers = {}
await super().setUpAsync()

async def receive_message(self, request):
payload = await request.json()
Expand All @@ -34,7 +35,6 @@ async def get_application(self):
app.add_routes([web.post("/", self.receive_message)])
return app

@unittest_run_loop
async def test_handle_message_no_api_key(self):
server_addr = f"http://localhost:{self.server.port}"

Expand All @@ -49,7 +49,6 @@ async def send_message(transport, payload, endpoint):
assert self.headers.get("x-api-key") is None
assert self.headers.get("content-type") == "application/json"

@unittest_run_loop
async def test_handle_message_api_key(self):
server_addr = f"http://localhost:{self.server.port}"
api_key = "test1234"
Expand All @@ -68,7 +67,6 @@ async def send_message(transport, payload, endpoint, api_key):
assert self.message_results == [{}]
assert self.headers.get("x-api-key") == api_key

@unittest_run_loop
async def test_handle_message_packed_compat_mime_type(self):
server_addr = f"http://localhost:{self.server.port}"

Expand All @@ -84,7 +82,6 @@ async def send_message(transport, payload, endpoint):
assert self.message_results == [{}]
assert self.headers.get("content-type") == "application/ssi-agent-wire"

@unittest_run_loop
async def test_handle_message_packed_standard_mime_type(self):
server_addr = f"http://localhost:{self.server.port}"

Expand All @@ -101,7 +98,6 @@ async def send_message(transport, payload, endpoint):
assert self.message_results == [{}]
assert self.headers.get("content-type") == "application/didcomm-envelope-enc"

@unittest_run_loop
async def test_stats(self):
server_addr = f"http://localhost:{self.server.port}"

Expand All @@ -122,7 +118,6 @@ async def send_message(transport, payload, endpoint):
"outbound-http:POST": 1,
}

@unittest_run_loop
async def test_transport_coverage(self):
transport = HttpTransport()
assert transport.wire_format is None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TestWsTransport(AioHTTPTestCase):
async def setUpAsync(self):
self.profile = InMemoryProfile.test_profile()
self.message_results = []
await super().setUpAsync()

async def receive_message(self, request):
ws = web.WebSocketResponse()
Expand All @@ -35,7 +36,6 @@ async def get_application(self):
app.add_routes([web.get("/", self.receive_message)])
return app

@unittest_run_loop
async def test_handle_message(self):
server_addr = f"ws://localhost:{self.server.port}"

Expand Down
10 changes: 1 addition & 9 deletions aries_cloudagent/utils/tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TestTransportUtils(AioHTTPTestCase):
async def setUpAsync(self):
self.fail_calls = 0
self.succeed_calls = 0
await super().setUpAsync()

async def get_application(self):
app = web.Application()
Expand All @@ -31,7 +32,6 @@ async def succeed_route(self, request):
ret = web.json_response([True])
return ret

@unittest_run_loop
async def test_fetch_stream(self):
server_addr = f"http://localhost:{self.server.port}"
stream = await fetch_stream(
Expand All @@ -41,15 +41,13 @@ async def test_fetch_stream(self):
assert result == b"[true]"
assert self.succeed_calls == 1

@unittest_run_loop
async def test_fetch_stream_default_client(self):
server_addr = f"http://localhost:{self.server.port}"
stream = await fetch_stream(f"{server_addr}/succeed")
result = await stream.read()
assert result == b"[true]"
assert self.succeed_calls == 1

@unittest_run_loop
async def test_fetch_stream_fail(self):
server_addr = f"http://localhost:{self.server.port}"
with self.assertRaises(FetchError):
Expand All @@ -61,7 +59,6 @@ async def test_fetch_stream_fail(self):
)
assert self.fail_calls == 2

@unittest_run_loop
async def test_fetch(self):
server_addr = f"http://localhost:{self.server.port}"
result = await fetch(
Expand All @@ -70,14 +67,12 @@ async def test_fetch(self):
assert result == [1]
assert self.succeed_calls == 1

@unittest_run_loop
async def test_fetch_default_client(self):
server_addr = f"http://localhost:{self.server.port}"
result = await fetch(f"{server_addr}/succeed", json=True)
assert result == [1]
assert self.succeed_calls == 1

@unittest_run_loop
async def test_fetch_fail(self):
server_addr = f"http://localhost:{self.server.port}"
with self.assertRaises(FetchError):
Expand All @@ -89,7 +84,6 @@ async def test_fetch_fail(self):
)
assert self.fail_calls == 2

@unittest_run_loop
async def test_put_file(self):
server_addr = f"http://localhost:{self.server.port}"
with async_mock.patch("builtins.open", mock_open(read_data="data")):
Expand All @@ -103,7 +97,6 @@ async def test_put_file(self):
assert result == [1]
assert self.succeed_calls == 1

@unittest_run_loop
async def test_put_file_default_client(self):
server_addr = f"http://localhost:{self.server.port}"
with async_mock.patch("builtins.open", mock_open(read_data="data")):
Expand All @@ -116,7 +109,6 @@ async def test_put_file_default_client(self):
assert result == [1]
assert self.succeed_calls == 1

@unittest_run_loop
async def test_put_file_fail(self):
server_addr = f"http://localhost:{self.server.port}"
with async_mock.patch("builtins.open", mock_open(read_data="data")):
Expand Down
8 changes: 4 additions & 4 deletions aries_cloudagent/utils/tests/test_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@


class TestRepeat(TestCase):
def test_iter(self):
async def test_iter(self):
expect = [5, 7, 11, 17, 25]
seq = test_module.RepeatSequence(5, interval=5.0, backoff=0.25)
assert [round(attempt.next_interval) for attempt in seq] == expect

seq = test_module.RepeatSequence(2, interval=5.0, backoff=0.25)
attempt = seq.start()
attempt = attempt.next()
attempt.timeout(interval=0.01)
with self.assertRaises(StopIteration):
attempt.next()
async with attempt.timeout(interval=0.01):
with self.assertRaises(StopIteration):
attempt.next()

async def test_aiter(self):
seq = test_module.RepeatSequence(5, interval=5.0, backoff=0.25)
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
aiohttp~=3.7.4
aiohttp~=3.8.1
aiohttp-apispec~=2.2.1
aiohttp-cors~=0.7.0
apispec~=3.3.0
async-timeout~=3.0.1
async-timeout~=4.0.2
aioredis~=2.0.0
base58~=2.1.0
deepmerge~=0.3.0
Expand Down

0 comments on commit cd5e63c

Please sign in to comment.