Ejemplo n.º 1
0
 def test_history_not_allowed_owner_in_room(self):
     self.join_room()
     self.set_owner()
     self.set_acl_single('history|age', str(int(BaseTest.AGE) + 10) + ':')
     act = self.activity_for_history()
     response_data = api.on_history(act, as_parser(act))
     self.assertEqual(200, response_data[0])
Ejemplo n.º 2
0
 def test_history_allowed_not_owner_in_room(self):
     self.join_room()
     self.remove_owner()
     self.remove_owner_channel()
     act = self.activity_for_history()
     response_data = api.on_history(act, as_parser(act))
     self.assertEqual(200, response_data[0])
Ejemplo n.º 3
0
 def test_history_allowed_owner_not_in_room(self):
     self.leave_room()
     self.set_owner()
     self.set_acl_single('history|sameroom', '')
     act = self.activity_for_history()
     response_data = api.on_history(act, as_parser(act))
     self.assertEqual(200, response_data[0])
Ejemplo n.º 4
0
    def test_history_contains_valid_timestamp(self):
        self.join_room()
        self.remove_owner()
        self.remove_owner_channel()
        self.send_message('my message')

        act = self.activity_for_history()
        response_data = api.on_history(act, as_parser(act))
        activity = as_parser(response_data[1])
        self.assertTrue(validate_timestamp(activity.object.attachments[0].published))
Ejemplo n.º 5
0
    def test_history_contains_correct_user_name(self):
        self.join_room()
        self.remove_owner()
        self.remove_owner_channel()
        self.send_message('my message')

        act = self.activity_for_history()
        response_data = api.on_history(act, as_parser(act))
        activity = as_parser(response_data[1])
        self.assertEqual(BaseTest.USER_NAME, b64d(activity.object.attachments[0].author.display_name))
Ejemplo n.º 6
0
    def test_history_contains_id(self):
        self.join_room()
        self.remove_owner()
        self.remove_owner_channel()
        self.send_message('my message')

        act = self.activity_for_history()
        response_data = api.on_history(act, as_parser(act))
        activity = as_parser(response_data[1])
        self.assertIsNotNone(activity.object.attachments[0].id)
Ejemplo n.º 7
0
    def test_history_contains_correct_sent_message(self):
        self.join_room()
        self.remove_owner()
        self.remove_owner_channel()

        message = 'my message'
        self.send_message(message)

        act = self.activity_for_history()
        response_data = api.on_history(act, as_parser(act))
        activity = as_parser(response_data[1])
        self.assertEqual(message, b64d(activity.object.attachments[0].content))
Ejemplo n.º 8
0
def on_history(data: dict, activity: Activity) -> (int, Union[str, dict, None]):
    return api.on_history(data, activity)
Ejemplo n.º 9
0
 def test_history(self):
     act = self.activity_for_history()
     response_data = api.on_history(act, as_parser(act))
     self.assertEqual(200, response_data[0])