mirror of
https://github.com/besterprotocol/besterd
synced 2023-12-13 21:00:32 +01:00
Added authentication test
This commit is contained in:
parent
3fde07c049
commit
82c45f0e9b
1 changed files with 16 additions and 3 deletions
|
@ -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()
|
Loading…
Reference in a new issue