~lvh/twisted/finger-tutorial-4679

« back to all changes in this revision

Viewing changes to twisted/test/test_newcred.py

  • Committer: exarkun
  • Date: 2010-09-16 18:34:44 UTC
  • Revision ID: svn-v4:bbbe8e31-12d6-0310-92fd-ac37d47ddeeb:trunk:30026
Merge remove-cred-util-4107

Author: cyli
Reviewer: mithrandi
Fixes: #4107

Remove `twisted.cred.util` and its corresponding deprecation tests.  This
re-merge corrects the fact that previously only the contents of
`twisted/cred/util.py` were removed, not the file itself.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
 
1
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
2
2
# See LICENSE for details.
3
3
 
4
4
"""
10
10
from zope.interface import implements, Interface
11
11
 
12
12
from twisted.trial import unittest
13
 
from twisted.cred import portal, checkers, credentials, error, util
 
13
from twisted.cred import portal, checkers, credentials, error
14
14
from twisted.python import components
15
15
from twisted.internet import defer
16
16
from twisted.internet.defer import deferredGenerator as dG, waitForDeferred as wFD
28
28
    from twisted.cred import pamauth
29
29
 
30
30
 
31
 
class DeprecatedUtilTests(unittest.TestCase):
32
 
    """
33
 
    Tests for the deprecation of the functions in L{twisted.cred.util}.
34
 
    """
35
 
    def test_respond(self):
36
 
        """
37
 
        L{respond} applies a particular hashing to a challenge and a password
38
 
        and returns the result.  It is deprecated and calling it emits a
39
 
        deprecation warning.
40
 
        """
41
 
        # Use some values and test against the known correct output.
42
 
        self.assertEqual(
43
 
            util.respond('foo', 'bar').encode('hex'),
44
 
            'ebe4a2902532198cafaa223fb5ac0f20')
45
 
 
46
 
        warnings = self.flushWarnings(offendingFunctions=[self.test_respond])
47
 
        self.assertEqual(
48
 
            warnings[0]['message'],
49
 
            'twisted.cred.util.respond is deprecated since Twisted 8.3.')
50
 
        self.assertEqual(
51
 
            warnings[0]['category'],
52
 
            PendingDeprecationWarning)
53
 
        self.assertEqual(len(warnings), 1)
54
 
 
55
 
 
56
 
    def test_challenge(self):
57
 
        """
58
 
        L{challenge} returns a different string each time it is called.
59
 
        """
60
 
        self.assertNotEqual(util.challenge(), util.challenge())
61
 
        warnings = self.flushWarnings(offendingFunctions=[self.test_challenge])
62
 
        for w in warnings:
63
 
            self.assertEqual(
64
 
                w['message'],
65
 
                'twisted.cred.util.challenge is deprecated since Twisted 8.3.')
66
 
            self.assertEqual(
67
 
                w['category'],
68
 
                PendingDeprecationWarning)
69
 
        self.assertEqual(len(warnings), 2)
70
 
 
71
 
 
72
 
 
73
31
class ITestable(Interface):
74
32
    pass
75
33