'L{digest.DigestCredentialFactory.decode} calls the C{decode} method on
L{twisted.cred.digest.DigestCredentialFactory} with the HTTP method and
host of the request.'

def test_decode(self):

    host = '169.254.0.1'
    method = 'GET'
    done = [False]
    response = object()
    def check(_response, _method, _host):
        self.assertEqual(response, _response)
        self.assertEqual(method, _method)
        self.assertEqual(host, _host)
        done[0] = True
    self.patch(self.credentialFactory.digest, 'decode', check)
    req = self.makeRequest(method, IPv4Address('TCP', host, 81))
    self.credentialFactory.decode(response, req)
    self.assertTrue(done[0])
