Use encode() method instead of bytearray()

to encode a Unicode string to a binary one.
This commit is contained in:
Nicola Soranzo
2018-08-21 12:35:05 +01:00
parent 5d1ced2678
commit f54246e1a1
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ class AuthenticationApiTestCase(api.ApiTestCase):
self._setup_user(TEST_USER_EMAIL, TEST_USER_PASSWORD)
baseauth_url = self._api_url("authenticate/baseauth", use_key=False)
unencoded_credentials = "%s:%s" % (TEST_USER_EMAIL, TEST_USER_PASSWORD)
authorization = base64.b64encode(bytearray(unencoded_credentials, encoding="utf-8"))
authorization = base64.b64encode(unencoded_credentials.encode("utf-8"))
headers = {
"Authorization": authorization,
}