1
0
Fork 0
mirror of https://github.com/besterprotocol/besterd synced 2023-12-13 21:00:32 +01:00
besterd/testing/testSuite.py

29 lines
688 B
Python
Raw Normal View History

2020-04-19 13:32:46 +02:00
2020-04-17 22:09:28 +02:00
import socket
import json
def basicTest():
d=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
2020-04-18 19:30:43 +02:00
d.connect(("127.0.0.1",2223))
2020-04-19 13:32:46 +02:00
bys=json.dumps({"header":{"authentication":{"username":"tbk", "password":"passwd"}, "scope":"client"},"payload":{"data":"ABBA","type":"type1"}})
2020-04-18 16:43:42 +02:00
print(bys)
2020-04-17 22:09:28 +02:00
d.send(bytes([len(bys),0,0,0]))
d.send(bys.encode())
2020-04-18 16:43:42 +02:00
d.close()
def simpleTest():
d=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
d.connect(("127.0.0.1",2224))
bys=json.dumps({"name":1})
print(bys)
d.send(bytes([len(bys),0,0,0]))
d.send(bys.encode())
while True: pass
2020-04-17 22:09:28 +02:00
d.close()
2020-04-18 16:43:42 +02:00
2020-04-17 22:09:28 +02:00
def runTests():
2020-04-18 16:43:42 +02:00
#simpleTest()
2020-04-17 22:09:28 +02:00
basicTest()
runTests()