Skip to content

Commit

Permalink
Fix unit test url routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ps committed Jan 24, 2015
1 parent c84429f commit a490a52
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test_httpauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def md5(str):

def get_ha1(user, pw, realm):
a1 = user + ":" + realm + ":" + pw
return md5(a1.encode('utf-8')).hexdigest()
return md5(a1).hexdigest()

class HTTPAuthTestCase(unittest.TestCase):
def setUp(self):
Expand All @@ -33,6 +33,7 @@ def setUp(self):

@digest_auth_ha1_pw.get_password
def get_digest_password(username):

if username == 'susan':
return get_ha1(username, 'hello', digest_auth_ha1_pw.realm)
elif username == 'john':
Expand Down Expand Up @@ -285,15 +286,15 @@ def test_digest_ha1_pw_auth_login_valid(self):

a1 = 'john:' + d['realm'] + ':bye'
ha1 = md5(a1).hexdigest()
a2 = 'GET:/digest'
a2 = 'GET:/digest_ha1_pw'
ha2 = md5(a2).hexdigest()
a3 = ha1 + ':' + d['nonce'] + ':' + ha2
auth_response = md5(a3).hexdigest()

response = self.client.get(
'/digest', headers={
'Authorization': 'Digest username="john",realm="{0}",'
'nonce="{1}",uri="/digest",response="{2}",'
'nonce="{1}",uri="/digest_ha1_pw",response="{2}",'
'opaque="{3}"'.format(d['realm'],
d['nonce'],
auth_response,
Expand Down

0 comments on commit a490a52

Please sign in to comment.