-
Notifications
You must be signed in to change notification settings - Fork 0
/
preinit.py
44 lines (36 loc) · 1.06 KB
/
preinit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
from api.models.api.login_request import LoginRequest
from tests.utils import get_random_email
url = "http://localhost:8000"
with requests.Session() as client:
email = get_random_email()
user_creation_res = client.post(
url=f"{url}/users/",
json={
"name": "Alice",
"age": 0,
"about": "string",
"email": email,
"password": "string",
},
)
friend_creation_res = client.post(
url=f"{url}/users/",
json={
"name": "Bob",
"age": 0,
"about": "string",
"email": get_random_email(),
"password": "string",
},
)
login_request = LoginRequest(email=email, password="string")
login_response = client.post(url=f"{url}/login/", json=login_request.dict())
print(login_response.headers)
friend_user_id = friend_creation_res.json()
client.post(
url=f"{url}/friends/add/{friend_user_id}",
)
client.post(
url=f"{url}/chat/start/{friend_user_id}",
)