Merge pull request #4 from IgorVolochay/frontend
This commit is contained in:
+16
-16
@@ -16,9 +16,9 @@ NON_EXIST_USER = random.randint(100000000, 1000000000)
|
||||
|
||||
# TEST ADD USERS UTILS #
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_add_user_non_full_data():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/add_user"
|
||||
data = {
|
||||
@@ -30,9 +30,9 @@ async def test_add_user_non_full_data():
|
||||
|
||||
assert raw_response.status_code == 422
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_add_user_negative_int_id():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/add_user"
|
||||
data = {
|
||||
@@ -47,9 +47,9 @@ async def test_add_user_negative_int_id():
|
||||
|
||||
assert raw_response.status_code == 422
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_add_new_user():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/add_user"
|
||||
data = {
|
||||
@@ -67,9 +67,9 @@ async def test_add_new_user():
|
||||
assert response.error == False
|
||||
assert User.model_validate(response.result)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_add_already_exist_user():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/add_user"
|
||||
data = {
|
||||
@@ -92,9 +92,9 @@ async def test_add_already_exist_user():
|
||||
|
||||
# TEST CHECK USERS UTILS #
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_check_non_exist_user():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/check_user"
|
||||
params = {"user_id": NON_EXIST_USER}
|
||||
@@ -106,9 +106,9 @@ async def test_check_non_exist_user():
|
||||
assert response.error == False
|
||||
assert response.result == False
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_check_exist_user():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/check_user"
|
||||
params = {"user_id": EXIST_USER}
|
||||
@@ -125,9 +125,9 @@ async def test_check_exist_user():
|
||||
|
||||
# TEST GET USERS UTILS #
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_get_non_exist_user():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/get_user"
|
||||
params = {"user_id": NON_EXIST_USER}
|
||||
@@ -139,9 +139,9 @@ async def test_get_non_exist_user():
|
||||
assert response.error == True
|
||||
assert response.result == "User doesn't exist"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio(loop_scope="session")
|
||||
async def test_get_exist_user():
|
||||
async with AsyncClient(transport=ASGITransport(app=app),
|
||||
async with AsyncClient(transport=ASGITransport(app=app, client=("127.0.0.1", 50000)),
|
||||
base_url='http://test') as client:
|
||||
end_point = "/get_user"
|
||||
params = {"user_id": EXIST_USER}
|
||||
|
||||
Reference in New Issue
Block a user