odapi/tests/requests_test.py

38 lines
1.0 KiB
Python
Raw Normal View History

2020-09-11 00:07:45 +02:00
from pytest import mark
2020-05-03 00:45:45 +02:00
from secrets import token_hex
2020-09-11 00:07:45 +02:00
from app.schemas import *
from tests import client
2020-05-03 00:45:45 +02:00
2020-09-11 00:07:45 +02:00
def test_registration():
2020-05-03 00:45:45 +02:00
user = {
"full_name": "Bilal Balaperdida",
"email": "oyvey@hotmail.com",
"password": "lifeisabitch",
2020-09-11 00:07:45 +02:00
"gender": 1,
2020-05-03 00:45:45 +02:00
"mobile": "+212655778899",
"user_type": 1,
"lang_type": 1,
"device_type": 1,
2020-09-11 00:07:45 +02:00
"device_id": token_hex(16),
"city_id": 5,
"access_key": token_hex(16),
"badge": 1,
2020-05-03 00:45:45 +02:00
}
response = client.post("/register", json=user)
2020-09-11 00:07:45 +02:00
assert response.status_code == 200
2020-09-11 00:07:45 +02:00
@mark.skip(reason="not implemented")
def test_login():
user = {
"email": "12@gmail.com",
"password": "odyfo2020",
"device_id": "fEll6hxazGQ:APA91bFpsB44ZHgjUItYOKTTmUxxkJsWiuaeojdxiTLVbz-AwN90XwLvpA6nRQoLrUYaF-HoHTz4Vc5S0VlqemerJ6MjG4zqwfNYB75whQVQI1M29yhMc3oFdl1me2zP_RY2dXbfx7UW",
"lang_type": 2,
"user_type": 1,
}
response = client.post("/login", json=user)
2020-09-11 00:07:45 +02:00
assert response.status_code == 200