示例#1
0
    def tearDown(self):
        doc = Documentation(self.host, self.path)
        doc.login(self.user, self.password)

        pages = doc.listPages(self.prefix)
        for p in pages: 
            p.delete()
      
        pages = doc.listPages(self.prefix, Documentation.NS_TEMPLATE)
        for p in pages:
            p.delete()
示例#2
0
    def test_listPages(self):
        doc = Documentation(self.host, self.path)
        doc.login(self.user, self.password)

        pagename = 'testlistPages'
        version = '0.1'
        self.assertTrue(doc.createPage(version, pagename, 'This is page %s' % pagename, self.prefix))
    
        pages = doc.listPages(os.path.join(self.prefix, version))
        for page in pages:
            self.assertFalse(pages.count > 1)
            self.assertEqual(page.name, os.path.join(self.prefix, version, pagename))
        self.assertEqual(pages.count, 1)
示例#3
0
    def test_listPagesAsTemplate(self):
        doc = Documentation(self.host, self.path)
        doc.login(self.user, self.password)
    
        templatePrefix = 'Template:' + self.prefix
        pagename = 'testlistPagesAsTemplate'
        version = '0.1'
        self.assertTrue(doc.createPage(version, pagename, 'This is page %s' % pagename, templatePrefix))

        pages = doc.listPages('/'.join((templatePrefix, version)))
        for page in pages:
            self.assertFalse(pages.count > 1)
            self.assertEqual(page.name, '/'.join((templatePrefix, version, pagename)))
        self.assertEqual(pages.count, 1)
示例#4
0
    def test_versionPages(self):
        doc = Documentation(self.host, self.path)
        doc.login(self.user, self.password)

        sourceVersion = '0.1'
        for pagename in ['Page1', 'Page2', 'Page3']:
            doc.createPage(sourceVersion, pagename, 'This is page %s' % pagename, self.prefix)
    
        targetVersion = '0.2'
        result = doc.versionPages(sourceVersion, targetVersion, [self.prefix])
        self.assertFalse(False in result)
示例#5
0
 def test_versionPagesAsTemplate(self):
     doc = Documentation(self.host, self.path)
     doc.login(self.user, self.password)
 
     templatePrefix = 'Template:' + self.prefix
   
     sourceVersion = '0.1'
     for pagename in ['template1', 'template2']:
         doc.createPage(sourceVersion, pagename, 'This is page %s' % pagename, templatePrefix)
   
     targetVersion = '0.2'
     result = doc.versionPages(sourceVersion, targetVersion, [templatePrefix])
     self.assertFalse(False in result)
示例#6
0
    def test_createPageAsTemplate(self):
        doc = Documentation(self.host, self.path)
        doc.login(self.user, self.password)

        for pagename in ['template1', 'template2']:
            self.assertTrue(doc.createPage('0.1', pagename, 'This is page %s' % pagename, 'Template:' + self.prefix))
示例#7
0
 def test_login(self):
     doc = Documentation(self.host, self.path)
     doc.login(self.user, self.password)