Example #1
0
    def testAttachments_without_page_creation(self):
        become_trusted(self.request)
        pagename = u"PackageAttachmentAttachWithoutPageCreation"
        script = u"""MoinMoinPackage|1
AddAttachment|1_attachment|my_test.txt|%(pagename)s
Print|Thank you for using PackagePages!
""" % {"pagename": pagename}
        zip_file = self.create_package(script)
        package = ZipPackage(self.request, zip_file)
        package.installPackage()
        assert not Page(self.request, pagename).exists()
        assert AttachFile.exists(self.request, pagename, "my_test.txt")

        nuke_page(self.request, pagename)
        os.unlink(zip_file)
Example #2
0
    def testAttachments_without_page_creation(self):
        become_trusted(self.request)
        pagename = u"PackageAttachmentAttachWithoutPageCreation"
        script = u"""MoinMoinPackage|1
AddAttachment|1_attachment|my_test.txt|%(pagename)s
Print|Thank you for using PackagePages!
""" % {
            "pagename": pagename
        }
        zip_file = self.create_package(script)
        package = ZipPackage(self.request, zip_file)
        package.installPackage()
        assert not Page(self.request, pagename).exists()
        assert AttachFile.exists(self.request, pagename, "my_test.txt")

        nuke_page(self.request, pagename)
        os.unlink(zip_file)
Example #3
0
    def testAttachments_after_page_creation(self):
        become_trusted(self.request)
        pagename = u'PackageTestPageCreatedFirst'
        page = create_page(self.request, pagename, u"This page has not yet an attachments dir")
        script = u"""MoinMoinPackage|1
AddRevision|1|%(pagename)s
AddAttachment|1_attachment|my_test.txt|%(pagename)s
Print|Thank you for using PackagePages!
""" % {"pagename": pagename}
        zip_file = self.create_package(script, page)
        package = ZipPackage(self.request, zip_file)
        package.installPackage()
        assert Page(self.request, pagename).exists()
        assert AttachFile.exists(self.request, pagename, "my_test.txt")

        nuke_page(self.request, pagename)
        os.unlink(zip_file)
Example #4
0
    def testAttachments_after_page_creation(self):
        become_trusted(self.request)
        pagename = u'PackageTestPageCreatedFirst'
        page = create_page(self.request, pagename,
                           u"This page has not yet an attachments dir")
        script = u"""MoinMoinPackage|1
AddRevision|1|%(pagename)s
AddAttachment|1_attachment|my_test.txt|%(pagename)s
Print|Thank you for using PackagePages!
""" % {
            "pagename": pagename
        }
        zip_file = self.create_package(script, page)
        package = ZipPackage(self.request, zip_file)
        package.installPackage()
        assert Page(self.request, pagename).exists()
        assert AttachFile.exists(self.request, pagename, "my_test.txt")

        nuke_page(self.request, pagename)
        os.unlink(zip_file)