Пример #1
0
 def test_nonexist_proto(self):
     'should return False if proto not in table'
     with patch.dict(Protocol.PROTOCOL_TABLE, {
         'proto' : 'content'
           }, clear=True):
         msg = 'content'
         self.assertFalse(Protocol.assert_protocol_type(msg, 'nonexist'))        
Пример #2
0
 def test_assert_wrong_proto_type(self):
     'should return False if msg not matched the reg of given proto'
     with patch.dict(Protocol.PROTOCOL_TABLE, {
         'proto' : 'content'
           }, clear=True):
         msg = 'somemsg'
         self.assertFalse(Protocol.assert_protocol_type(msg, 'proto'))
Пример #3
0
 def test_assert_right_proto_type(self):
     'should return True if the msg if matched the reg of  given proto'
     with patch.dict(Protocol.PROTOCOL_TABLE, {
        'proto' : 'content'
         }, clear=True):
         msg = 'content'
         self.assertTrue(Protocol.assert_protocol_type(msg, 'proto'))
Пример #4
0
 def test_nonexist_proto(self):
     'should return False if proto not in table'
     with patch.dict(Protocol.PROTOCOL_TABLE, {'proto': 'content'},
                     clear=True):
         msg = 'content'
         self.assertFalse(Protocol.assert_protocol_type(msg, 'nonexist'))
Пример #5
0
 def test_assert_wrong_proto_type(self):
     'should return False if msg not matched the reg of given proto'
     with patch.dict(Protocol.PROTOCOL_TABLE, {'proto': 'content'},
                     clear=True):
         msg = 'somemsg'
         self.assertFalse(Protocol.assert_protocol_type(msg, 'proto'))
Пример #6
0
 def test_assert_right_proto_type(self):
     'should return True if the msg if matched the reg of  given proto'
     with patch.dict(Protocol.PROTOCOL_TABLE, {'proto': 'content'},
                     clear=True):
         msg = 'content'
         self.assertTrue(Protocol.assert_protocol_type(msg, 'proto'))