async def user_by_id(request: web.Request): user_id: str = request.match_info["user_id"] user = await UsersService.get_user_by_id(int(user_id), UsersBackend()) status_code = HTTPStatus.OK if user else HTTPStatus.NOT_FOUND return web.json_response(UserResource(user=user).dict(), status=status_code)
async def users_list(request: web.Request): users = await UsersService.get_users(UsersBackend()) return web.json_response(UserListResource(users=users).dict())
async def setUp(self): await super(UsersBackendTest, self).setUp() self.backend = UsersBackend()