CherryPy / cherrypy / test / test_httpauth.py

Diff from to

cherrypy/test/test_httpauth.py

 
         def sha_password_encrypter(password):
             return sha(ntob(password)).hexdigest()
-        
+
         def fetch_password(username):
             return sha(ntob('test')).hexdigest()
 
                             'tools.basic_auth.realm': 'localhost',
                             'tools.basic_auth.users': fetch_password,
                             'tools.basic_auth.encrypt': sha_password_encrypter}}
-                
+
         root = Root()
         root.digest = DigestProtected()
         root.basic = BasicProtected()
 
         self.getPage('/basic/', [('Authorization', 'Basic dGVzdDp0ZX60')])
         self.assertStatus(401)
-        
+
         self.getPage('/basic/', [('Authorization', 'Basic dGVzdDp0ZXN0')])
         self.assertStatus('200 OK')
         self.assertBody("Hello test, you've been authorized.")
 
         self.getPage('/basic2/', [('Authorization', 'Basic dGVzdDp0ZX60')])
         self.assertStatus(401)
-        
+
         self.getPage('/basic2/', [('Authorization', 'Basic dGVzdDp0ZXN0')])
         self.assertStatus('200 OK')
         self.assertBody("Hello test, you've been authorized.")
     def testDigest(self):
         self.getPage("/digest/")
         self.assertStatus(401)
-        
+
         value = None
         for k, v in self.headers:
             if k.lower() == "www-authenticate":
         for item in items:
             key, value = item.split('=')
             tokens[key.lower()] = value
-            
+
         missing_msg = "%s is missing"
         bad_value_msg = "'%s' was expecting '%s' but found '%s'"
         nonce = None
         auth = base_auth % (nonce, '', '00000001')
         params = httpauth.parseAuthorization(auth)
         response = httpauth._computeDigestResponse(params, 'test')
-        
+
         auth = base_auth % (nonce, response, '00000001')
         self.getPage('/digest/', [('Authorization', auth)])
         self.assertStatus(401)
         auth = base_auth % (nonce, '', '00000001')
         params = httpauth.parseAuthorization(auth)
         response = httpauth._computeDigestResponse(params, 'test')
-        
+
         auth = base_auth % (nonce, response, '00000001')
         self.getPage('/digest/', [('Authorization', auth)])
         self.assertStatus('200 OK')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.