Skip to content

Commit

Permalink
UTF8
Browse files Browse the repository at this point in the history
  • Loading branch information
rraks committed Feb 4, 2020
1 parent f5035d0 commit fcec346
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/HTTPserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def monitorTaskResult(res):

def verify_password(username, password):
''' Auth '''
hashed_password = hashlib.sha512(password).hexdigest()
hashed_password = hashlib.sha512(password.encode("UTF-8")).hexdigest()
msg = {"username": username, "password": hashed_password}
''' TODO: don't use mqtt for user authentiaction '''
res = lbc.VerifyUser.delay(json.dumps(msg))
Expand Down Expand Up @@ -114,7 +114,7 @@ def userfunc():
data = request.get_json(force=True)
user_name = data["username"]
user_pass = data["password"]
hashed_password = hashlib.sha512(user_pass).hexdigest()
hashed_password = hashlib.sha512(user_pass.encode("UTF-8")).hexdigest()
msg = {"username": user_name, "password": hashed_password}
res = lbc.AddUser.delay(json.dumps(msg))
ret = monitorTaskResult(res)
Expand Down
8 changes: 4 additions & 4 deletions tests/testSuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_simpleFlow(self):
resp_streams = [s["stream_id"] for s in resp.json()]
self.assertEqual(resp.status_code, 200)
print("All streams: ", resp_streams)
raw_input()
input()
for stream in resp_streams:
self.assertTrue(stream in stream_ids)
''' Request for stream '''
Expand All @@ -205,7 +205,7 @@ def test_simpleFlow(self):
resp_json = resp.json()
self.assertFalse(resp_json["info"] == "unavailable")

raw_input()
input()
'''
Reverse Pass
'''
Expand All @@ -216,7 +216,7 @@ def test_simpleFlow(self):
resp = self.vs.deleteStream(stream["stream_id"])
self.assertEqual(resp.status_code, 200)
resp_json = resp.json()
raw_input()
input()
''' Show all streams '''
#resp = self.vs.allStreams()
#stream_ids = [s["stream_id"] for s in self.streams]
Expand All @@ -234,7 +234,7 @@ def test_simpleFlow(self):
''' Delete origin server '''
#resp = self.vs.deleteOrigin(self.origin_id)
#print(resp.json())
#raw_input()
#input()
#self.assertEqual(resp.status_code, 200)
''' Show all origin servers '''
#resp = self.vs.allOrigin()
Expand Down

0 comments on commit fcec346

Please sign in to comment.