Beispiel #1
0
 def test_leave(self):
     msg = JimMessage()
     msg.compose('leave', room='#chatroom')
     assert msg.encode(), {
         'action': 'leave',
         'time': int(time.time()),
         'room': '#chatroom'
     }
Beispiel #2
0
 def test_msg(self):
     msg = JimMessage()
     msg.compose('msg',
                 msg_to='Recipient',
                 msg_from='Sender',
                 msg='Test Message')
     assert msg.encode(), {
         'action': 'msg',
         'to': 'Recipient',
         'from': 'Sender',
         'time': int(time.time()),
         'message': 'Test Message'
     }
Beispiel #3
0
 def test_auth(self):
     msg = JimMessage()
     msg.compose('authenticate',
                 user={
                     'account_name': 'JohnDoe',
                     'password': '******'
                 })
     assert msg.encode(), {
         'action': 'authenticate',
         'time': int(time.time()),
         'user': {
             'account_name': 'JohnDoe',
             'password': '******'
         }
     }
Beispiel #4
0
 def test_presence(self):
     msg = JimMessage()
     msg.compose('presence',
                 user={
                     'account_name': 'JohnDoe',
                     'status': 'here'
                 })
     assert msg.encode(), {
         'action': 'presence',
         'time': int(time.time()),
         'user': {
             'account_name': 'JohnDoe',
             'status': 'here'
         }
     }
Beispiel #5
0
 def test_quit(self):
     msg = JimMessage()
     msg.compose('quit')
     assert msg.encode() == {'action': 'quit', 'time': int(time.time())}
Beispiel #6
0
 def test_probe(self):
     msg = JimMessage()
     msg.compose('probe')
     assert msg.encode() == {'action': 'probe', 'time': int(time.time())}
Beispiel #7
0
 def test_probe(self):
     msg = JimMessage()
     msg.compose('probe')
     self.assertEqual(msg.encode(), {'action': 'probe', 'time': int(time.time())})
Beispiel #8
0
 def test_join(self):
     msg = JimMessage()
     msg.compose('join', room='#chatroom')
     self.assertEqual(msg.encode(), {'action': 'join', 'time': int(time.time()), 'room': '#chatroom'})
Beispiel #9
0
 def test_quit(self):
     msg = JimMessage()
     msg.compose('quit')
     self.assertEqual(msg.encode(), {'action': 'quit', 'time': int(time.time())})