source: wokkel/test/test_iwokkel.py @ 192:16e03a099c98

Last change on this file since 192:16e03a099c98 was 165:76a61f5aa343, checked in by Ralph Meijer <ralphm@…>, 11 years ago

Cleanups leading up to Wokkel 0.7.0.

As we now depend on Twisted 10.0.0 or higher, the following classes and
interfaces were deprecated:

This also resolves all Pyflakes warnings, changes links for www.xmpp.org to
xmpp.org and fixes the copyright notice in LICENSE to include 2012.

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 twisted.trial import unittest
9
10class DeprecationTest(unittest.TestCase):
11    """
12    Deprecation test for L{wokkel.subprotocols}.
13    """
14
15    def lookForDeprecationWarning(self, testmethod, attributeName, newName):
16        """
17        Importing C{testmethod} emits a deprecation warning.
18        """
19        warningsShown = self.flushWarnings([testmethod])
20        self.assertEqual(len(warningsShown), 1)
21        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
22        self.assertEqual(
23            warningsShown[0]['message'],
24            "wokkel.iwokkel." + attributeName + " "
25            "was deprecated in Wokkel 0.7.0: Use " + newName + " instead.")
26
27
28    def test_iXMPPHandler(self):
29        """
30        L{wokkel.iwokkel.IXMPPHandler} is deprecated.
31        """
32        from wokkel.iwokkel import IXMPPHandler
33        IXMPPHandler
34        self.lookForDeprecationWarning(
35                self.test_iXMPPHandler,
36                "IXMPPHandler",
37                "twisted.words.protocols.jabber.ijabber."
38                    "IXMPPHandler")
39
40
41    def test_iXMPPHandlerCollection(self):
42        """
43        L{wokkel.iwokkel.IXMPPHandlerCollection} is deprecated.
44        """
45        from wokkel.iwokkel import IXMPPHandlerCollection
46        IXMPPHandlerCollection
47        self.lookForDeprecationWarning(
48                self.test_iXMPPHandlerCollection,
49                "IXMPPHandlerCollection",
50                "twisted.words.protocols.jabber.ijabber."
51                    "IXMPPHandlerCollection")
Note: See TracBrowser for help on using the repository browser.