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()))
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)
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 ) )
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'] )
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)
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()))
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)