source: wokkel/test/test_iwokkel.py @ 193:2b4214c8f5de

Last change on this file since 193:2b4214c8f5de was 193:2b4214c8f5de, checked in by Ralph Meijer <ralphm@…>, 5 years ago

imported patch py3-iwokkel.patch

File size: 1.6 KB
Line 
1# Copyright (c) Ralph Meijer.
2# See LICENSE for details.
3
4"""
5Tests for L{wokkel.iwokkel}
6"""
7
8from __future__ import division, absolute_import
9
10from twisted.trial import unittest
11
12class DeprecationTest(unittest.TestCase):
13    """
14    Deprecation test for L{wokkel.subprotocols}.
15    """
16
17    def lookForDeprecationWarning(self, testmethod, attributeName, newName):
18        """
19        Importing C{testmethod} emits a deprecation warning.
20        """
21        warningsShown = self.flushWarnings([testmethod])
22        self.assertEqual(len(warningsShown), 1)
23        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
24        self.assertEqual(
25            warningsShown[0]['message'],
26            "wokkel.iwokkel." + attributeName + " "
27            "was deprecated in Wokkel 0.7.0: Use " + newName + " instead.")
28
29
30    def test_iXMPPHandler(self):
31        """
32        L{wokkel.iwokkel.IXMPPHandler} is deprecated.
33        """
34        from wokkel.iwokkel import IXMPPHandler
35        IXMPPHandler
36        self.lookForDeprecationWarning(
37                self.test_iXMPPHandler,
38                "IXMPPHandler",
39                "twisted.words.protocols.jabber.ijabber."
40                    "IXMPPHandler")
41
42
43    def test_iXMPPHandlerCollection(self):
44        """
45        L{wokkel.iwokkel.IXMPPHandlerCollection} is deprecated.
46        """
47        from wokkel.iwokkel import IXMPPHandlerCollection
48        IXMPPHandlerCollection
49        self.lookForDeprecationWarning(
50                self.test_iXMPPHandlerCollection,
51                "IXMPPHandlerCollection",
52                "twisted.words.protocols.jabber.ijabber."
53                    "IXMPPHandlerCollection")
Note: See TracBrowser for help on using the repository browser.