diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2017-12-17 12:34:32 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-12-17 12:38:41 -0500 |
| commit | 661dc06ffa9a872824d628975657b21325654f2e (patch) | |
| tree | 36027d71593578354faf50c5a227cf637388a4ff /cherrypy/test/test_httpauth.py | |
| parent | 49bc467811b74e100a6f5e007409e9d9baaa5f6a (diff) | |
| parent | 0e4542295a33fd776f2ca5f1bb151eb8ddf919a0 (diff) | |
| download | cherrypy-git-archive/1285-always-bytes.tar.gz | |
Merge branch 'master' into bb-pr-85archive/1285-always-bytes
Diffstat (limited to 'cherrypy/test/test_httpauth.py')
| -rw-r--r-- | cherrypy/test/test_httpauth.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cherrypy/test/test_httpauth.py b/cherrypy/test/test_httpauth.py index 8be48b6b..3a5cff27 100644 --- a/cherrypy/test/test_httpauth.py +++ b/cherrypy/test/test_httpauth.py @@ -9,33 +9,34 @@ from cherrypy.test import helper class HTTPAuthTest(helper.CPWebCase): + @staticmethod def setup_server(): class Root: + @cherrypy.expose def index(self): - return "This is public." - index.exposed = True + return 'This is public.' class DigestProtected: + @cherrypy.expose def index(self): return "Hello %s, you've been authorized." % ( cherrypy.request.login) - index.exposed = True class BasicProtected: + @cherrypy.expose def index(self): return "Hello %s, you've been authorized." % ( cherrypy.request.login) - index.exposed = True class BasicProtected2: + @cherrypy.expose def index(self): return "Hello %s, you've been authorized." % ( cherrypy.request.login) - index.exposed = True def fetch_users(): return {'test': 'test'} @@ -72,16 +73,15 @@ class HTTPAuthTest(helper.CPWebCase): root.basic = BasicProtected() root.basic2 = BasicProtected2() cherrypy.tree.mount(root, config=conf) - setup_server = staticmethod(setup_server) def testPublic(self): - self.getPage("/") + self.getPage('/') self.assertStatus('200 OK') self.assertHeader('Content-Type', 'text/html;charset=utf-8') self.assertBody('This is public.') def testBasic(self): - self.getPage("/basic/") + self.getPage('/basic/') self.assertStatus(401) self.assertHeader('WWW-Authenticate', 'Basic realm="localhost"') @@ -93,7 +93,7 @@ class HTTPAuthTest(helper.CPWebCase): self.assertBody("Hello test, you've been authorized.") def testBasic2(self): - self.getPage("/basic2/") + self.getPage('/basic2/') self.assertStatus(401) self.assertHeader('WWW-Authenticate', 'Basic realm="localhost"') @@ -105,19 +105,19 @@ class HTTPAuthTest(helper.CPWebCase): self.assertBody("Hello test, you've been authorized.") def testDigest(self): - self.getPage("/digest/") + self.getPage('/digest/') self.assertStatus(401) value = None for k, v in self.headers: - if k.lower() == "www-authenticate": - if v.startswith("Digest"): + if k.lower() == 'www-authenticate': + if v.startswith('Digest'): value = v break if value is None: self._handlewebError( - "Digest authentification scheme was not found") + 'Digest authentification scheme was not found') value = value[7:] items = value.split(', ') @@ -126,7 +126,7 @@ class HTTPAuthTest(helper.CPWebCase): key, value = item.split('=') tokens[key.lower()] = value - missing_msg = "%s is missing" + missing_msg = '%s is missing' bad_value_msg = "'%s' was expecting '%s' but found '%s'" nonce = None if 'realm' not in tokens: |
