예제 #1
0
 def test_leave(self):
     msg = JimMessage()
     msg.compose('leave', room='#chatroom')
     assert msg.encode(), {
         'action': 'leave',
         'time': int(time.time()),
         'room': '#chatroom'
     }
예제 #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'
     }
예제 #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': '******'
         }
     }
예제 #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'
         }
     }
예제 #5
0
 def test_quit(self):
     msg = JimMessage()
     msg.compose('quit')
     assert msg.encode() == {'action': 'quit', 'time': int(time.time())}
예제 #6
0
 def test_probe(self):
     msg = JimMessage()
     msg.compose('probe')
     assert msg.encode() == {'action': 'probe', 'time': int(time.time())}
예제 #7
0
 def test_probe(self):
     msg = JimMessage()
     msg.compose('probe')
     self.assertEqual(msg.encode(), {'action': 'probe', 'time': int(time.time())})
예제 #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'})
예제 #9
0
 def test_quit(self):
     msg = JimMessage()
     msg.compose('quit')
     self.assertEqual(msg.encode(), {'action': 'quit', 'time': int(time.time())})