Fix tests

This commit is contained in:
Santiago Lo Coco 2023-10-23 14:06:46 -03:00
parent 433c2c3de3
commit e91574fe3c
4 changed files with 7 additions and 4 deletions

View File

@ -4,7 +4,7 @@ FROM ${BASE_IMAGE}
ENV FLASK_DEBUG=1 ENV FLASK_DEBUG=1
ENV FLASK_ENV=development ENV FLASK_ENV=development
ENV DATABASE_TEST_URL=postgresql://postgres:postgres@usermanager-db:5432/api_test ENV DATABASE_TEST_URL=postgresql://user:password@usermanager-db:5432/api_test
# add and install requirements # add and install requirements
COPY --chown=python:python ./requirements.test.txt . COPY --chown=python:python ./requirements.test.txt .

View File

@ -54,8 +54,8 @@ class Login(Resource):
access_token = user.encode_token(user.id, "access", user.airline) access_token = user.encode_token(user.id, "access", user.airline)
refresh_token = user.encode_token(user.id, "refresh") refresh_token = user.encode_token(user.id, "refresh")
response_object = {"access_token": access_token, response_object = {"access_token": access_token,
"refresh_token": refresh_token, "refresh_token": refresh_token,
"user_id": user.id} "user_id": user.id}
return response_object, 200 return response_object, 200

View File

@ -89,8 +89,9 @@ class User(db.Model):
def get_api_auth_full_user_model(cls, namespace): def get_api_auth_full_user_model(cls, namespace):
return namespace.clone( return namespace.clone(
"User Full", "User Full",
cls.get_api_auth_user_model(namespace),
{ {
"username": fields.String(required=True),
"email": fields.String(required=True),
"password": fields.String(required=True), "password": fields.String(required=True),
}, },
) )

View File

@ -22,6 +22,8 @@ def test_user_registration(test_app, test_database):
content_type="application/json", content_type="application/json",
) )
data = json.loads(resp.data.decode()) data = json.loads(resp.data.decode())
print(data)
print(resp)
assert resp.status_code == 201 assert resp.status_code == 201
assert resp.content_type == "application/json" assert resp.content_type == "application/json"
assert TEST_USERNAME in data["username"] assert TEST_USERNAME in data["username"]