Add user registration test
This commit is contained in:
10
tests/conftest.py
Normal file
10
tests/conftest.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from app import app as test_app
|
||||
from pytest import fixture
|
||||
from secrets import token_bytes
|
||||
|
||||
|
||||
@fixture
|
||||
def app():
|
||||
test_app.config["TESTING"] = True
|
||||
test_app.config["WTF_CSRF_ENABLED"] = False
|
||||
return test_app
|
||||
@@ -1,4 +1,5 @@
|
||||
from app.models import *
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def test_users():
|
||||
@@ -52,8 +53,9 @@ def test_user_ratings():
|
||||
|
||||
|
||||
def test_venue_images():
|
||||
test = VenueImages.query.filter_by(id=3).first()
|
||||
assert test.user_id == 9
|
||||
test = VenueImages.query.filter_by(id=6).first()
|
||||
date = datetime(year=2019, month=7, day=28, hour=14, minute=1, second=21)
|
||||
assert test.updated == date
|
||||
|
||||
|
||||
def test_venues():
|
||||
@@ -63,7 +65,8 @@ def test_venues():
|
||||
|
||||
def test_view_news():
|
||||
test = ViewNews.query.filter_by(id=57).first()
|
||||
assert test.news_id == 10
|
||||
date = datetime(year=2019, month=7, day=16, hour=11, minute=32, second=16)
|
||||
assert test.created == date
|
||||
|
||||
|
||||
def test_web_bookings():
|
||||
|
||||
23
tests/requests_test.py
Normal file
23
tests/requests_test.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from app.models import *
|
||||
from config import Config
|
||||
from pytest import fixture
|
||||
from secrets import token_hex
|
||||
from werkzeug.security import generate_password_hash
|
||||
|
||||
|
||||
def test_registration(client):
|
||||
user = {
|
||||
"full_name": "Bilal Balaperdida",
|
||||
"email": "oyvey@hotmail.com",
|
||||
"password": generate_password_hash(password="lifeisabitch", method="md5"),
|
||||
"gender": 3,
|
||||
"mobile": "+212655778899",
|
||||
"city_id": 12,
|
||||
"user_type": 1,
|
||||
"lang_type": 1,
|
||||
"device_id": token_hex(8),
|
||||
"device_type": 1,
|
||||
"badge": 0,
|
||||
}
|
||||
response = client.post("/register", json=user)
|
||||
assert response.status == "200 OK"
|
||||
Reference in New Issue
Block a user