-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
102 lines (100 loc) · 2.72 KB
/
test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import requests
from tools import request,calculate
import json
import configloader
c = configloader.config()
handler = request.request_handler()
data = {
"message_id":calculate.genuuid(),
"message":"test",
"application":"pvm",
"destination":calculate.genuuid(),
}
ret = handler.post_request("/v0/east/addmessage",data)
data = {
"messages":[
{
"message_id":calculate.genuuid(),
"message":"test",
"application":"pvm",
"destination":calculate.genuuid(),
},
{
"message_id":calculate.genuuid(),
"message":"test",
"application":"pvm",
"destination":calculate.genuuid(),
},
{
"message_id":calculate.genuuid(),
"message":"test",
"application":"pvm",
"destination":calculate.genuuid(),
},
{
"message_id":calculate.genuuid(),
"message":"test",
"application":"pvm",
"destination":calculate.genuuid(),
},
{
"message_id":calculate.genuuid(),
"message":"test",
"application":"pvm",
"destination":calculate.genuuid(),
}
]
}
ret = handler.post_request("/v0/east/addmessages",data)
print(ret)
new_message_uuid = "2f1bfa0d-12ca-4258-b42a-a5b6ef396b6a"
new_destination_uuid = "e5305c5e-6439-4704-a7d3-3d58e6c3309e"
data = {
"message_id":new_message_uuid,
"message":"test",
"application":"pvm",
"destination":new_destination_uuid,
}
ret = handler.post_request("/v0/east/getstatus",data)
print(ret)
data = {
"messages":[
{
"message_id":new_message_uuid,
"message":"test",
"application":"pvm",
"destination":new_destination_uuid,
},
]
}
ret = handler.post_request("/v0/east/getmultistatus",data)
print(ret)
data = {
}
ret = handler.post_request("/v0/west/getmessages",data)
print(ret)
messages = ret["messages"]
data = {
"messages":[]
}
is_first = True
for message_id,message in messages.items():
if is_first:
is_first = False
sign = calculate.sha512(".".join([message_id, c.getkey("client_id"), "pvm", message["message"]]))
once_data = {
"message_id":message_id,
"application":"pvm",
"sign":sign
}
ret = handler.post_request("/v0/west/updatestatus",once_data)
print(ret)
continue
sign = calculate.sha512(".".join([message_id, c.getkey("client_id"), "pvm", message["message"]]))
data["messages"].append({
"message_id":message_id,
"application":"pvm",
"sign":sign
})
ret = handler.post_request("/v0/west/updatemultistatus",data)
print(ret)