Skip to content

Commit

Permalink
Fix tests to actually test the values of the attributes.
Browse files Browse the repository at this point in the history
This code was broken since 2007 (beginning of the history of this file.)
  • Loading branch information
Michael Howitz committed Oct 9, 2018
1 parent 9d5829e commit 060f17a
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class FauxHTTPResponse:

_unauthorized_called = 0
realm = 'unit test'
headers = {}

def __init__(self):
self.headers = {}

def unauthorized(self):

Expand Down Expand Up @@ -107,9 +109,9 @@ def test_challenge(self):

self.assertFalse(response._unauthorized_called)
helper.challenge(request, response)
self.assertTrue(response.status, 401)
self.assertTrue(response.headers['WWW-Authenticate'],
'basic realm="unit test"')
self.assertEqual(response.status, 401)
self.assertEqual(response.headers['WWW-Authenticate'],
'basic realm="unit test"')

def test_multi_challenge(self):
# It is possible for HTTP headers to contain multiple auth headers
Expand All @@ -123,8 +125,8 @@ def test_multi_challenge(self):
response.realm = 'second realm'
helper.challenge(request, response)

self.assertTrue(response.status, 401)
self.assertTrue(response.headers['WWW-Authenticate'],
self.assertEqual(response.status, 401)
self.assertEqual(response.headers['WWW-Authenticate'],
['basic realm="unit test"',
'basic realm="second realm"'])

Expand Down

0 comments on commit 060f17a

Please sign in to comment.