'L{DigestCredentialFactory.decode} raises L{LoginFailed} when the given
nonce from the response does not match the nonce encoded in the opaque.'

def test_incompatibleNonce(self):

    credentialFactory = FakeDigestCredentialFactory(self.algorithm, self.realm)
    challenge = credentialFactory.getChallenge(self.clientAddress.host)
    badNonceOpaque = credentialFactory._generateOpaque('1234567890', self.clientAddress.host)
    exc = self.assertRaises(LoginFailed, credentialFactory._verifyOpaque, badNonceOpaque, challenge['nonce'], self.clientAddress.host)
    self.assertEqual(str(exc), 'Invalid    response,    incompatible    opaque/nonce    values')
    exc = self.assertRaises(LoginFailed, credentialFactory._verifyOpaque, badNonceOpaque, '', self.clientAddress.host)
    self.assertEqual(str(exc), 'Invalid    response,    incompatible    opaque/nonce    values')
