-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitTest.py
46 lines (34 loc) · 1.9 KB
/
UnitTest.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
45
46
import requests
url = 'https://localhost:8080/'
headers = {'Content-Type': 'application/json'}
# response = requests.post(url, json=json_data, headers=headers)
json_data = {'ChatRoomId': 'RaymondheRoom'}
response = requests.post(url+'AddChatRoom', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {}
response = requests.post(url+'GetChatRooms', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'UserName':'Raymondhe', 'PreferredLanguage':'Emoji'}
response = requests.post(url+'AddUser', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'UserName':'DonaldTrump', 'PreferredLanguage':'Kaomoji'}
response = requests.post(url+'AddUser', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'UserName':'Raymondhe', 'ChatRoomId':'RaymondheRoom', 'Message':'你好吗'}
response = requests.post(url+'AddMessage', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'UserName':'Raymondhe', 'ChatRoomId':'RaymondheRoom', 'Message':'我很好,不过我有点饿了'}
response = requests.post(url+'AddMessage', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'UserName':'Raymondhe', 'ChatRoomId':'RaymondheRoom', 'Message':'我很好,不过我有点饿了'}
response = requests.post(url+'AddMessage', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'UserName':'DonaldTrump', 'ChatRoomId':'RaymondheRoom', 'Message':'I am the best!'}
response = requests.post(url+'AddMessage', json=json_data, verify=False, headers=headers)
print(response.json())
json_data = {'ChatRoomId':'RaymondheRoom'}
response = requests.post(url+'GetHistory', json=json_data, verify=False)
print(response.json())
json_data = {}
response = requests.post(url+'GetChatRooms', json=json_data, verify=False, headers=headers)
print(response.json())