Test suite now prompts user to enter ausername to authenticate to the server with

This commit is contained in:
Tristan B. Kildaire 2020-04-27 16:34:30 +02:00
parent f139e9f5a1
commit 54f6bc18c2
2 changed files with 4 additions and 2 deletions

View File

@ -2,12 +2,14 @@
import socket import socket
import json import json
usernameSelect = input("Enter username: ")
def basicTest(): def basicTest():
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))
# First do it and authenticate # First do it and authenticate
bys=json.dumps({"header":{"authentication":{"username":"tbk", "password":"passwd"}, "scope":"client"},"payload":{"data":"ABBA","type":"type1"}}) bys=json.dumps({"header":{"authentication":{"username":usernameSelect, "password":"passwd"}, "scope":"client"},"payload":{"data":"ABBA","type":"type1"}})
print(len(bys), bys) print(len(bys), bys)
d.send(len(bys).to_bytes(4, "little")) d.send(len(bys).to_bytes(4, "little"))
d.send(bys.encode()) d.send(bys.encode())

View File

@ -11,7 +11,7 @@ def runTest():
bys = json.dumps({ bys = json.dumps({
"header" : { "header" : {
"status" : "0", "status" : "0",
"command" : {"type" : "sendClients", "data": ["usr1", "usr2"]} "command" : {"type" : "sendClients", "data": ["tbk", "tbk"]}
} }) } })
print(s.send(bytes([len(bys),0,0,0]))) print(s.send(bytes([len(bys),0,0,0])))
print(s.send(bys.encode())) print(s.send(bys.encode()))