'L{DigestCredentialFactory.decode} raises L{LoginFailed} when the opaque
checksum fails verification.'

def test_mismatchedOpaqueChecksum(self):

    credentialFactory = FakeDigestCredentialFactory(self.algorithm, self.realm)
    challenge = credentialFactory.getChallenge(self.clientAddress.host)
    key = ','.join((challenge['nonce'], networkString(self.clientAddress.host), '0'))
    digest = hexlify(md5((key + 'this    is    not    the    right    pkey')).digest())
    badChecksum = '-'.join((digest, b64encode(key)))
    self.assertRaises(LoginFailed, credentialFactory._verifyOpaque, badChecksum, challenge['nonce'], self.clientAddress.host)
