Skip to content

Commit a1ed2de

Browse files
Fix str/bytes problem
1 parent 0adb58e commit a1ed2de

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_oauth2_session.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ def token_updater(token):
132132
def fake_refresh_with_auth(r, **kwargs):
133133
if "/refresh" in r.url:
134134
self.assertIn("Authorization", r.headers)
135-
encoded = b64encode(b"%s:%s" % (self.client_id, self.client_secret))
136-
content = (b"Basic " + encoded).decode('latin1')
135+
encoded = b64encode(
136+
"{client_id}:{client_secret}"
137+
.format(client_id=self.client_id, client_secret=self.client_secret)
138+
.encode('latin1')
139+
)
140+
content = "Basic {encoded}".format(encoded=encoded.decode('latin1'))
137141
self.assertEqual(r.headers["Authorization"], content)
138142
resp = mock.MagicMock()
139143
resp.text = json.dumps(self.token)

0 commit comments

Comments
 (0)