'L{DigestCredentialFactory.decode} raises L{LoginFailed} when the
request comes from a client IP other than what is encoded in the
opaque.'

def test_incompatibleClientIP(self):

    credentialFactory = FakeDigestCredentialFactory(self.algorithm, self.realm)
    challenge = credentialFactory.getChallenge(self.clientAddress.host)
    badAddress = '10.0.0.1'
    self.assertNotEqual(self.clientAddress.host, badAddress)
    badNonceOpaque = credentialFactory._generateOpaque(challenge['nonce'], badAddress)
    self.assertRaises(LoginFailed, credentialFactory._verifyOpaque, badNonceOpaque, challenge['nonce'], self.clientAddress.host)
