Skip to content

Commit

Permalink
make_mocked_request: subscriptable default app
Browse files Browse the repository at this point in the history
  • Loading branch information
butla committed Aug 5, 2018
1 parent cf3a384 commit 908684c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aiohttp/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def teardown_test_loop(loop, fast=False):


def _create_app_mock():
app = mock.Mock()
app = mock.MagicMock()
app._debug = False
app.on_response_prepare = Signal(app)
app.on_response_prepare.freeze()
Expand Down
5 changes: 5 additions & 0 deletions tests/test_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def test_make_mocked_request_app():
assert req.app is app


def test_make_mocked_request_app_doesnt_crash_on_key_access():
req = make_mocked_request('GET', '/')
req.app["accessing this shouldn't crash"]


def test_make_mocked_request_match_info():
req = make_mocked_request('GET', '/', match_info={'a': '1', 'b': '2'})
assert req.match_info == {'a': '1', 'b': '2'}
Expand Down

0 comments on commit 908684c

Please sign in to comment.