示例#1
0
 def test_list_user_actions(self):
     user_log.log_user_action(self.user_object.id, action='/users/login')
     user_action = user_log.list_user_actions(self.user_object.id,
                                              user=self.user_object)
     expected = {'action': '/users/login', 'user_id': 1}
     self.assertTrue(
         all(item in user_action[0].items() for item in expected.items()))
示例#2
0
 def test_list_none_user_actions(self):
     user_log.log_user_action(
         self.user_object.id,
         action='/testaction'
     )
     user_action = user_log.list_user_actions(
         2,
         user=self.user_object
     )
     self.assertEqual([], user_action)
示例#3
0
def list_user_actions(uesr_id):
    """List user actions."""
    data = _get_request_args()
    _filter_timestamp(data)
    return utils.make_json_response(
        200,
        user_log_api.list_user_actions(
            current_user, user_id, **data
        )
    )
示例#4
0
 def test_list_user_actions(self):
     user_log.log_user_action(
         self.user_object.id,
         action='/testaction'
     )
     user_action = user_log.list_user_actions(
         self.user_object,
         self.user_object.id
     )
     self.assertEqual(
         1,
         user_action[0]['user_id']
     )
示例#5
0
 def test_del_user_actions(self):
     user_log.log_user_action(
         self.user_object.id,
         action='/testaction'
     )
     user_log.del_user_actions(
         self.user_object.id,
         user=self.user_object
     )
     del_user_action = user_log.list_user_actions(
         self.user_object.id,
         user=self.user_object
     )
     self.assertEqual([], del_user_action)
示例#6
0
 def test_list_user_actions(self):
     user_log.log_user_action(
         self.user_object.id,
         action='/users/login'
     )
     user_action = user_log.list_user_actions(
         self.user_object.id,
         user=self.user_object
     )
     expected = {
         'action': '/users/login',
         'user_id': 1
     }
     self.assertTrue(
         all(item in user_action[0].items()
             for item in expected.items()))
示例#7
0
 def test_del_user_actions(self):
     user_log.log_user_action(self.user_object.id, action='/testaction')
     user_log.del_user_actions(self.user_object.id, user=self.user_object)
     del_user_action = user_log.list_user_actions(self.user_object.id,
                                                  user=self.user_object)
     self.assertEqual([], del_user_action)