Tests pass on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-01-12 14:24:17 -05:00
parent c076e1ee26
commit 4940da47da

View File

@ -9,6 +9,8 @@ from __future__ import (
division,
)
from future.builtins import str
from testtools.matchers import (
Equals,
)
@ -56,6 +58,7 @@ class PrivacyTests(SyncTestCase):
return super(PrivacyTests, self).setUp()
def _authorization(self, scheme, value):
value = str(value, "utf-8")
return Headers({
u"authorization": [u"{} {}".format(scheme, value)],
})
@ -90,7 +93,7 @@ class PrivacyTests(SyncTestCase):
self.assertThat(
self.client.head(
b"http:///foo/bar",
headers=self._authorization(SCHEME, u"foo bar"),
headers=self._authorization(str(SCHEME, "utf-8"), b"foo bar"),
),
succeeded(has_response_code(Equals(UNAUTHORIZED))),
)
@ -103,7 +106,7 @@ class PrivacyTests(SyncTestCase):
self.assertThat(
self.client.head(
b"http:///foo/bar",
headers=self._authorization(SCHEME, self.token),
headers=self._authorization(str(SCHEME, "utf-8"), self.token),
),
# It's a made up URL so we don't get a 200, either, but a 404.
succeeded(has_response_code(Equals(NOT_FOUND))),