예제 #1
0
    def test_send_room_message(self):
        act = self.activity_for_join(BaseTest.OTHER_USER_ID, BaseTest.ROOM_ID)
        api.on_join(act, as_parser(act))

        act = self.activity_for_message('this is a message')
        act['actor']['id'] = BaseTest.OTHER_USER_ID
        act['target']['objectType'] = 'room'

        api.on_message(act, as_parser(act))

        # make sure hooks have fired, async
        time.sleep(0.05)

        self.assertIsNotNone(self.msgs_sent.get(BaseTest.ROOM_ID))
예제 #2
0
def on_message(data: dict, activity: Activity) -> (int, Union[dict, str, None]):
    return api.on_message(data, activity)
예제 #3
0
 def send_message(self, message: str) -> dict:
     act = self.activity_for_message(message)
     return api.on_message(act, as_parser(act))
예제 #4
0
 def test_send_message(self):
     self.create_and_join_room()
     act = self.activity_for_message()
     response_data = api.on_message(act, as_parser(act))
     self.assertEqual(200, response_data[0])