def test_create_user(self, client, db, test_user): users_url = url_for("api_v1.list_users") user_data = { "username": "******", "password": "******", "email": "*****@*****.**", "household_id": test_user.household_id, } rep = client.post(users_url, json=user_data, headers={"Content-Type": "application/json"}) assert rep.status_code == 201 data = rep.get_json()["data"] user = User.get_by_id(data["id"]) assert user.username == "created" assert user.email == "*****@*****.**"
def post(self): user_identity = get_jwt_identity() user = User.get_by_id(user_identity["id"]) access_token = user.get_refresh_token() return {"access_token": access_token}, HTTPStatus.OK