Implement user registration
This commit is contained in:
		
							parent
							
								
									43433d9dce
								
							
						
					
					
						commit
						f470f8bff7
					
				@ -1,8 +1,9 @@
 | 
				
			|||||||
from datetime import datetime
 | 
					from datetime import datetime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from pytest import fixture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from database.models import *
 | 
					from database.models import *
 | 
				
			||||||
from tests import TestingSessionLocal
 | 
					from tests import TestingSessionLocal
 | 
				
			||||||
from pytest import fixture
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@fixture
 | 
					@fixture
 | 
				
			||||||
 | 
				
			|||||||
@ -1,27 +1,31 @@
 | 
				
			|||||||
from database.models import *
 | 
					from pytest import mark
 | 
				
			||||||
from pytest import fixture
 | 
					 | 
				
			||||||
from secrets import token_hex
 | 
					from secrets import token_hex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from app.schemas import *
 | 
				
			||||||
 | 
					from tests import client
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_registration(client):
 | 
					
 | 
				
			||||||
 | 
					def test_registration():
 | 
				
			||||||
    user = {
 | 
					    user = {
 | 
				
			||||||
        "full_name": "Bilal Balaperdida",
 | 
					        "full_name": "Bilal Balaperdida",
 | 
				
			||||||
        "email": "oyvey@hotmail.com",
 | 
					        "email": "oyvey@hotmail.com",
 | 
				
			||||||
        "password": "lifeisabitch",
 | 
					        "password": "lifeisabitch",
 | 
				
			||||||
        "gender": 3,
 | 
					        "gender": 1,
 | 
				
			||||||
        "mobile": "+212655778899",
 | 
					        "mobile": "+212655778899",
 | 
				
			||||||
        "city_id": 12,
 | 
					 | 
				
			||||||
        "user_type": 1,
 | 
					        "user_type": 1,
 | 
				
			||||||
        "lang_type": 1,
 | 
					        "lang_type": 1,
 | 
				
			||||||
        "device_id": token_hex(16),
 | 
					 | 
				
			||||||
        "device_type": 1,
 | 
					        "device_type": 1,
 | 
				
			||||||
        "badge": 0,
 | 
					        "device_id": token_hex(16),
 | 
				
			||||||
 | 
					        "city_id": 5,
 | 
				
			||||||
 | 
					        "access_key": token_hex(16),
 | 
				
			||||||
 | 
					        "badge": 1,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    response = client.post("/register", json=user)
 | 
					    response = client.post("/register", json=user)
 | 
				
			||||||
    assert response.status == "200 OK"
 | 
					    assert response.status_code == 200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_login(client):
 | 
					@mark.skip(reason="not implemented")
 | 
				
			||||||
 | 
					def test_login():
 | 
				
			||||||
    user = {
 | 
					    user = {
 | 
				
			||||||
        "email": "12@gmail.com",
 | 
					        "email": "12@gmail.com",
 | 
				
			||||||
        "password": "odyfo2020",
 | 
					        "password": "odyfo2020",
 | 
				
			||||||
@ -30,4 +34,4 @@ def test_login(client):
 | 
				
			|||||||
        "user_type": 1,
 | 
					        "user_type": 1,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    response = client.post("/login", json=user)
 | 
					    response = client.post("/login", json=user)
 | 
				
			||||||
    assert response.status == "200 OK"
 | 
					    assert response.status_code == 200
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user