'L{DigestCredentialFactory.decode} raises L{LoginFailed} when the given
opaque is older than C{DigestCredentialFactory.CHALLENGE_LIFETIME_SECS}'

def test_oldNonce(self):

    credentialFactory = FakeDigestCredentialFactory(self.algorithm, self.realm)
    challenge = credentialFactory.getChallenge(self.clientAddress.host)
    key = ','.join((challenge['nonce'], networkString(self.clientAddress.host), '-137876876'))
    digest = hexlify(md5((key + credentialFactory.privateKey)).digest())
    ekey = b64encode(key)
    oldNonceOpaque = '-'.join((digest, ekey.strip('\n')))
    self.assertRaises(LoginFailed, credentialFactory._verifyOpaque, oldNonceOpaque, challenge['nonce'], self.clientAddress.host)
