Esempio n. 1
0
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)
Esempio n. 2
0
async def users_list(request: web.Request):
    users = await UsersService.get_users(UsersBackend())
    return web.json_response(UserListResource(users=users).dict())
Esempio n. 3
0
 async def setUp(self):
     await super(UsersBackendTest, self).setUp()
     self.backend = UsersBackend()