conftest e2e auth/test user create

This commit is contained in:
2026-08-17 19:33:23 +03:00
parent 0a4a21f2e7
commit 1eb9935a15
5 changed files with 61 additions and 21 deletions
+38 -4
View File
@@ -1,14 +1,48 @@
import allure
import pytest
from httpx import HTTPStatusError
from tests.e2e.conftest import MySession, e2e_settings
@pytest.mark.integra
class TestCrud:
@pytest.mark.parametrize("email",[
("Test_Email@test.com")
("test@d.d")
])
async def test_get_user_by_email_positive(self):
async def test_get_user_by_email_positive(self, email:str, auth_fixture:MySession)->None:
with allure.step(""):
pass
with allure.step("Get user by email"):
target_url=f"http://{e2e_settings.HOST}:{e2e_settings.PORT}"
response = await auth_fixture.get(f"{target_url}/user/get_by_email",params={"email":email})
response.raise_for_status()
response=response.json()
with allure.step("Validate response"):
assert response.get("email")==email
assert "TEST_" in response.get("first_name")
assert "TEST_" in response.get("last_name")
assert "TEST_" in response.get("middle_name")
assert response.get("direct_permissions")==[]
assert response.get("group")==[]
assert not response.get("hashed_password") or not response.get("plain_password") or not response.get("password")
@pytest.mark.parametrize("email, expected_exception", [
("test@test.test", HTTPStatusError),
("test", HTTPStatusError),
("@d", HTTPStatusError)
])
async def test_get_user_by_email_negative(self, email:str, expected_exception, auth_fixture:MySession)->None:
with allure.step("Get user by email"), pytest.raises(expected_exception):
target_url=f"http://{e2e_settings.HOST}:{e2e_settings.PORT}"
response = await auth_fixture.get(f"{target_url}/user/get_by_email",params={"email":email})
response.raise_for_status()