-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.py
More file actions
53 lines (38 loc) · 1.59 KB
/
test2.py
File metadata and controls
53 lines (38 loc) · 1.59 KB
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
45
46
47
48
49
50
51
52
53
import requests
#server it is running on.
listenHere = "http://127.0.0.1:5000"
#this will test ADDING a client/Cancel.
#true sends data to .json and false is Client canceled
def tAddClient(success=True):
clientData = {
"name": "Kaye Dela Chica" if success else "CANCEL",
"email": "delachic@oregonstate.edu",
"phone": "123-456-7890"
}
response = requests.post(f"{listenHere}/clients", json=clientData)
print(f"\nTesting Add Client ({'Success' if success else 'Cancel'}):", response.json())
print(f"Status Code: {response.status_code}, Response: {response.json()}")
#this will test ADDING a photoshoot(booking)/Cancel.
#same here, true sends data to .json and false is Client canceled
def tAddPS(success=True):
psData = {
"client": "Kaye Dela Chica" if success else "CANCEL",
"date": "2025-03-05",
"time": "12:00",
"location": "Porland"
}
response = requests.post(f"{listenHere}/photoshoots", json=psData)
print(f"\nTestinf Add Photoshoot ({'Success' if success else 'Cancel'}):", response.json())
print(f"Status Code: {response.status_code}, Response: {response.json()}")
def tViewAppt():
response = requests.get(f"{listenHere}/appts")
data = response.json()
print(f"\nTest View appts (Status Code {response.status_code}):", data)
# Run all tests
if __name__ == "__main__":
print("\n~~~~~~ TEST RUN HERE ~~~~~~\n")
tAddClient(success=True)
tAddClient(success=False)
tAddPS(success=True)
tAddPS(success=False)
tViewAppt()