e2e crud 0.2
This commit is contained in:
+17
-6
@@ -40,25 +40,36 @@ async def auth_fixture():
|
||||
yield session
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function", autouse=True)
|
||||
async def test_user_fixture(auth_fixture: MySession):
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
async def test_user_fixture(request, auth_fixture: MySession):
|
||||
|
||||
url=f"http://{e2e_settings.HOST}:{e2e_settings.PORT}"
|
||||
test_id=uuid4()
|
||||
|
||||
direct_permission_param, group_param = request.param
|
||||
|
||||
new_user_record={
|
||||
"first_name":f"TEST_{test_id}",
|
||||
"last_name":f"TEST_{test_id}",
|
||||
"middle_name":f"TEST_{test_id}",
|
||||
"email":"test@d.d",
|
||||
"email":f"TEST_{test_id}@d.d",
|
||||
"plain_password":"Test1234!",
|
||||
"direct_permissions":[],
|
||||
"group":[]
|
||||
"direct_permissions":direct_permission_param,
|
||||
"group":group_param
|
||||
}
|
||||
response=await auth_fixture.post(f"{url}/user/create_user", json=new_user_record)
|
||||
response.raise_for_status()
|
||||
|
||||
yield auth_fixture
|
||||
|
||||
async with MySession() as session:
|
||||
|
||||
payload={"username": new_user_record.get("email"), "password": new_user_record.get("plain_password")}
|
||||
|
||||
response = await session.post(url + "/protected/token", data=payload)
|
||||
response.raise_for_status()
|
||||
session.token = response.json()["access_token"]
|
||||
|
||||
yield (session, new_user_record)
|
||||
|
||||
response=await auth_fixture.post(f"{url}/user/delete_user_hard", params={"email":new_user_record.get("email")})
|
||||
response.raise_for_status()
|
||||
Reference in New Issue
Block a user