diff options
| author | Barry Warsaw | 2014-12-15 18:44:17 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2014-12-15 18:44:17 -0500 |
| commit | acf95993ceb605c71ad07a32a572ae1f0888a7de (patch) | |
| tree | cf0dfe685c8f6fcd5949b4ff3709f4481ddbe163 /src/mailman/rest/tests/test_root.py | |
| parent | d91715ea8b2692475b0751742e131bc1673b138b (diff) | |
| download | mailman-acf95993ceb605c71ad07a32a572ae1f0888a7de.tar.gz mailman-acf95993ceb605c71ad07a32a572ae1f0888a7de.tar.zst mailman-acf95993ceb605c71ad07a32a572ae1f0888a7de.zip | |
Diffstat (limited to 'src/mailman/rest/tests/test_root.py')
| -rw-r--r-- | src/mailman/rest/tests/test_root.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mailman/rest/tests/test_root.py b/src/mailman/rest/tests/test_root.py index c5787bcb1..49877c3ae 100644 --- a/src/mailman/rest/tests/test_root.py +++ b/src/mailman/rest/tests/test_root.py @@ -102,22 +102,23 @@ class TestRoot(unittest.TestCase): } response, raw_content = Http().request(url, 'GET', None, headers) self.assertEqual(response.status, 401) - content = json.loads(raw_content) + content = json.loads(raw_content.decode('utf-8')) self.assertEqual(content['title'], '401 Unauthorized') self.assertEqual(content['description'], 'The REST API requires authentication') def test_unauthorized(self): # Bad Basic Auth credentials results in a 401 error. - auth = b64encode('baduser:badpass') + userpass = b64encode(b'baduser:badpass') + auth = 'Basic {}'.format(userpass.decode('ascii')) url = 'http://localhost:9001/3.0/system' headers = { 'Content-Type': 'application/x-www-form-urlencode', - 'Authorization': 'Basic ' + auth, + 'Authorization': auth, } response, raw_content = Http().request(url, 'GET', None, headers) self.assertEqual(response.status, 401) - content = json.loads(raw_content) + content = json.loads(raw_content.decode('utf-8')) self.assertEqual(content['title'], '401 Unauthorized') self.assertEqual(content['description'], 'User is not authorized for the REST API') |
