Example #1
0
    def test_views1(self):
        view = Editor(self.page, self.request)
        user = User(u"test")
        user.groups.append("group:editor")

        view.sortpages()
        view.sortelements()

        self.request.GET = {"id": self.text1.id}
        self.assertRaises(HTTPFound, view.moveup)
        self.assertRaises(HTTPFound, view.movedown)
        self.assertRaises(HTTPFound, view.movetop)
        self.assertRaises(HTTPFound, view.movebottom)
Example #2
0
    def test_views1(self):
        view = Editor(self.page, self.request)
        user = User(u"test")
        user.groups.append("group:editor")

        view.sortpages()
        view.sortelements()
        
        self.request.GET = {"id": self.text1.id}
        self.assertRaises(HTTPFound, view.moveup)
        self.assertRaises(HTTPFound, view.movedown)
        self.assertRaises(HTTPFound, view.movetop)
        self.assertRaises(HTTPFound, view.movebottom)
Example #3
0
    def test_views1(self):
        view = Editor(self.page, self.request)
        user = User(u"test")
        user.groups.append("group:editor")

        cp = view.SetCopyInfo("copy", [self.text1.id, self.text2.id], self.page)
        self.assert_(cp == ",".join(["copy", str(self.text1.id), str(self.text2.id)]))
        c1, c2 = view.GetCopyInfo()
        self.assert_(c1=="copy")
        self.assert_(len(c2)==2)
        self.assertFalse(view.ClipboardEmpty())
        view.DeleteCopyInfo()
        self.assert_(view.ClipboardEmpty())
        c1, c2 = view.GetCopyInfo()
        self.assert_(c1=="")
        self.assert_(len(c2)==0)

        self.request.GET = {"ids": [self.text1.id, self.text2.id]}
        self.assertRaises(HTTPFound, view.copy)
        c1, c2 = view.GetCopyInfo()
        self.assert_(c1=="copy")
        self.assert_(len(c2)==2)
        view.DeleteCopyInfo()

        self.assertRaises(HTTPFound, view.cut)
        c1, c2 = view.GetCopyInfo()
        self.assert_(c1=="cut")
        self.assert_(len(c2)==2)

        self.assertRaises(HTTPFound, view.copy)
        view.context = self.page
        self.assertRaises(HTTPFound, view.paste)
        new_texts = self.page.GetObjs()
        self.assert_(len(new_texts)==2)
        
        self.request.GET = {"ids": [text.id for text in new_texts]}
        view.context = self.page
        self.assertRaises(HTTPFound, view.cut)
        view.context = self.root
        self.assertRaises(HTTPFound, view.paste)
        ooo = self.page.GetObjs()
        self.assertFalse(len(self.page.GetObjs()))
        self.assert_(self.root.Delete(new_texts[0].id, user))
        self.assert_(self.root.Delete(new_texts[1].id, user))