Ignore:
Timestamp:
Jul 10, 2013, 11:55:33 PM (7 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Do proper fallback for Request.stanzaType.

If stanzaType is not passed to the constructor of
wokkel.generic.Request, it should default to the value in the class
variable, not get.

Author: ralphm
Fixes: #80

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_generic.py

    r184 r185  
    276276
    277277
     278    def test_stanzaTypeInit(self):
     279        """
     280        If stanzaType is passed in __init__, it overrides the class variable.
     281        """
     282
     283        class SetRequest(generic.Request):
     284            stanzaType = 'set'
     285
     286        request = SetRequest(stanzaType='get')
     287        self.assertEqual('get', request.stanzaType)
     288
     289
     290    def test_stanzaTypeClass(self):
     291        """
     292        If stanzaType is not passed in __init__, the class variable is used.
     293        """
     294
     295        class SetRequest(generic.Request):
     296            stanzaType = 'set'
     297
     298        request = SetRequest()
     299        self.assertEqual('set', request.stanzaType)
     300
     301
    278302
    279303class PrepareIDNNameTests(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.