Skip to content

Commit 6c4c342

Browse files
author
Mathew Seymour
committed
[RD-35945] Fixed encoding for python3
1 parent c4d7e24 commit 6c4c342

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

tests/e2etests/chrome/test_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_standard_auth_page(self):
254254

255255
self.assertTrue(len(responses_received) >= 2) # Headed browser creates extra requests
256256
self.assertIn(200, responses_received)
257-
self.assertNotIn(401, responses_received)
257+
self.assertNotIn(401, responses_received) # Devtools genuinely doesn't report these
258258

259259

260260
class Test_ChromeInterface_set_baic_auth_headed(

tests/e2etests/testsite/start.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import multiprocessing
2-
from base64 import b64decode
3-
42
import time
3+
from base64 import b64decode
54

65
import cherrypy
76

@@ -63,10 +62,10 @@ def is_authenticated(authorized_username, authorized_password):
6362

6463
if "Authorization" in cherrypy.request.headers:
6564

66-
this_username, this_password = tuple(
67-
b64decode(cherrypy.request.headers["Authorization"].split("Basic ")[1]).split(":")
68-
)
69-
65+
auth_string = str(cherrypy.request.headers["Authorization"])
66+
secret = auth_string.split("Basic ")[1]
67+
credentials = b64decode(secret).decode()
68+
this_username, this_password = tuple(credentials.split(":"))
7069
if (this_username == authorized_username) and (this_password == authorized_password):
7170
return True
7271
return False

0 commit comments

Comments
 (0)