Exemple #1
0
 def test_update_cnt(self):
     self.add_w_h()
     aa = MWikiHist.get_by_uid(self.uid)
     post_data = {'user_name': self.username, 'cnt_md': 'asdf'}
     MWikiHist.update_cnt(self.uid, post_data)
     bb = MWikiHist.get_by_uid(self.uid)
     assert aa.cnt_md != bb.cnt_md
     assert bb.cnt_md == post_data['cnt_md']
     self.tearDown()
Exemple #2
0
    def restore(self, hist_uid):
        '''
        Restore by ID
        '''
        if self.check_post_role()['ADMIN']:
            pass
        else:
            return False
        histinfo = MWikiHist.get_by_uid(hist_uid)
        if histinfo:
            pass
        else:
            return False

        postinfo = MWiki.get_by_uid(histinfo.wiki_id)
        cur_cnt = tornado.escape.xhtml_unescape(postinfo.cnt_md)
        old_cnt = tornado.escape.xhtml_unescape(histinfo.cnt_md)

        MWiki.update_cnt(histinfo.wiki_id, {
            'cnt_md': old_cnt,
            'user_name': self.userinfo.user_name
        })

        MWikiHist.update_cnt(histinfo.uid, {
            'cnt_md': cur_cnt,
            'user_name': postinfo.user_name
        })

        if postinfo.kind == '1':
            self.redirect('/wiki/{0}'.format(postinfo.title))
        elif postinfo.kind == '2':
            self.redirect('/page/{0}.html'.format(postinfo.uid))
    def delete(self, uid):
        if self.check_post_role()['DELETE']:
            pass
        else:
            return False

        histinfo = MWikiHist.get_by_uid(uid)
        if histinfo:
            pass
        else:
            return False

        postinfo = MWiki.get_by_uid(histinfo.wiki_id)
        MWikiHist.delete(uid)
        self.redirect('/wiki_man/view/{0}'.format(postinfo.uid))
Exemple #4
0
 def test_get_by_uid(self):
     self.add_w_h()
     aa = MWikiHist.get_by_uid(self.uid)
     assert aa.user_name == self.username
Exemple #5
0
 def test_get_by_uid(self):
     MWikiHist.get_by_uid(self.userinfo['uid'])
     assert True
Exemple #6
0
 def test_get_by_uid(self):
     MWikiHist.get_by_uid(self.uid)
     assert True