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

Added authentication test

This commit is contained in:
Tristan B. Kildaire 2020-04-19 21:41:03 +02:00
parent 3fde07c049
commit 82c45f0e9b

View file

@ -11,12 +11,24 @@ def basicTest():
d.send(bys.encode()) d.send(bys.encode())
d.close() d.close()
def basicTest2(): def commandBuiltInClose():
d=socket.socket(socket.AF_INET, socket.SOCK_STREAM) d=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
d.connect(("127.0.0.1",2223)) d.connect(("127.0.0.1",2223))
bys=json.dumps({"header": {"scope" : "client"},"payload": { bys=json.dumps({"header": {"scope" : "client"},"payload": {
"data": { "data": {
"command" : {"type" : "close", "command" : None} "command" : {"type" : "close", "args" : None}
},"type":"builtin"}})
print(bys)
d.send(bytes([len(bys),0,0,0]))
d.send(bys.encode())
d.close()
def commandAuthTest():
d=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
d.connect(("127.0.0.1",2223))
bys=json.dumps({"header": {"scope" : "client"},"payload": {
"data": {
"command" : {"type" : "login", "args" : {"username" :"1", "password":"2"}}
},"type":"builtin"}}) },"type":"builtin"}})
print(bys) print(bys)
d.send(bytes([len(bys),0,0,0])) d.send(bytes([len(bys),0,0,0]))
@ -39,6 +51,7 @@ def simpleTest():
def runTests(): def runTests():
#simpleTest() #simpleTest()
basicTest() basicTest()
basicTest2() commandBuiltInClose()
commandAuthTest()
runTests() runTests()