def test_unauthorized(self, mocked_logger): """ Default HTTP 401 with errors """ base = BaseController() with pytest.raises(web.HTTPUnauthorized) as expected: base.unauthorized() mocked_logger.assert_called_once() assert expected.value.status == 401
async def test_authentication_error(self): base = BaseController() base.unauthorized = MagicMock('aaa') base.handle_service_errors(AuthenticationError(401, '')) base.unauthorized.assert_called_with()