class ConnectMessageParserTestCase(unittest.TestCase):
    def setUp(self):
        self.parser = ConnectMessageParser()
        self.version = 'pre2'
        self.support = ['pre2', 'pre1']
        self.session = 'session'

    def test_with_support_without_session(self):
        message = self.parser.parse({
            'msg': 'connect',
            'version': self.version,
            'support': self.support
        })
        self.assertEqual(message,
                         ConnectMessage(self.version, support=self.support))

    def test_without_support_with_session(self):
        message = self.parser.parse({
            'msg': 'connect',
            'version': self.version,
            'session': self.session
        })
        self.assertEqual(message,
                         ConnectMessage(self.version, session=self.session))

    def test_without_support_without_session(self):
        message = self.parser.parse({
            'msg': 'connect',
            'version': self.version
        })
        self.assertEqual(message, ConnectMessage(self.version))
class ConnectMessageParserTestCase(unittest.TestCase):
    def setUp(self):
        self.parser = ConnectMessageParser()
        self.version = 'pre2'
        self.support = ['pre2', 'pre1']
        self.session = 'session'

    def test_with_support_without_session(self):
        message = self.parser.parse({'msg': 'connect', 'version': self.version,
                                     'support': self.support})
        self.assertEqual(message, ConnectMessage(self.version,
                                                 support=self.support))

    def test_without_support_with_session(self):
        message = self.parser.parse({'msg': 'connect', 'version': self.version,
                                     'session': self.session})
        self.assertEqual(message, ConnectMessage(self.version,
                                                 session=self.session))

    def test_without_support_without_session(self):
        message = self.parser.parse({'msg': 'connect',
                                    'version': self.version})
        self.assertEqual(message, ConnectMessage(self.version))
 def setUp(self):
     self.parser = ConnectMessageParser()
     self.version = 'pre2'
     self.support = ['pre2', 'pre1']
     self.session = 'session'
 def setUp(self):
     self.parser = ConnectMessageParser()
     self.version = 'pre2'
     self.support = ['pre2', 'pre1']
     self.session = 'session'