def test_update_row(self): keys = ['nickname'] values = ['TheRenamedOne'] db_old_user = DBDiscussionSession.query(User).order_by( User.uid.asc()).first() return_val = admin.update_row('User', [db_old_user.uid], keys, values) db_old_user = DBDiscussionSession.query(User).filter_by( nickname=new_user['nickname']).all() db_new_user = DBDiscussionSession.query(User).filter_by( nickname=values[0]).all() self.assertTrue(return_val) self.assertEqual(len(db_old_user), 0) self.assertEqual(len(db_new_user), 1) db_reset = admin.update_row('User', [db_new_user[0].uid], keys, [nick_of_anonymous_user]) self.assertTrue(db_reset)
def main_update(request): """ View configuration for updating any row :param request: current webservers request :return: dict() """ LOG.debug("def %s", request.params) table = request.validated['table'] uids = request.validated['uids'] keys = request.validated['keys'] values = request.validated['values'] return lib.update_row(table, uids, keys, values)
def main_update(request): """ View configuration for updating any row :param request: current webservers request :return: dict() """ logger('Admin', 'def ' + str(request.params)) table = request.validated['table'] uids = request.validated['uids'] keys = request.validated['keys'] values = request.validated['values'] return lib.update_row(table, uids, keys, values)