1366
1366
# Only one 'Authentication Required' error should occur
1367
1367
self.assertEqual(1, self.server.auth_required_errors)
1369
def test_changing_nonce(self):
1370
if self._auth_scheme != 'digest':
1371
raise tests.TestNotApplicable('HTTP auth digest only test')
1372
if self._testing_pycurl():
1373
raise tests.KnownFailure(
1374
'pycurl does not handle a nonce change')
1375
self.server.add_user('joe', 'foo')
1376
t = self.get_user_transport('joe', 'foo')
1377
self.assertEqual('contents of a\n', t.get('a').read())
1378
self.assertEqual('contents of b\n', t.get('b').read())
1379
# Only one 'Authentication Required' error should have
1381
self.assertEqual(1, self.server.auth_required_errors)
1382
# The server invalidates the current nonce
1383
self.server.auth_nonce = self.server.auth_nonce + '. No, now!'
1384
self.assertEqual('contents of a\n', t.get('a').read())
1385
# Two 'Authentication Required' errors should occur (the
1386
# initial 'who are you' and a second 'who are you' with the new nonce)
1387
self.assertEqual(2, self.server.auth_required_errors)
1371
1391
class TestProxyAuth(TestAuth):