def test_getPreviousItem_startFromFirstFile(self):
     currentfile = self.portal.file0
     navviewlet = NavigationViewlet(
         currentfile, {'compilationuid': IUUID(self.compilation)}, {}, None)
     navviewlet.update()
     currentItem = navviewlet.getCurrentItem()
     self.assertEqual(navviewlet.getPreviousItem(currentItem), None)
 def test_getPreviousItem_startFromSecondFile(self):
     currentfile = self.portal.file1
     navviewlet = NavigationViewlet(
         currentfile, {'compilationuid': IUUID(self.compilation)}, {}, None)
     navviewlet.update()
     currentItem = navviewlet.getCurrentItem()
     prevItem = self.compilation.section001.contentref0
     self.assertEqual(navviewlet.getPreviousItem(currentItem), prevItem)
 def test_NextItem(self):
     currentfile = self.portal.file0
     navviewlet = NavigationViewlet(
         currentfile, {'compilationuid': IUUID(self.compilation)}, {}, None)
     navviewlet.update()
     currentItem = navviewlet.getCurrentItem()
     nextContentRef = self.compilation.section002.contentref1
     self.assertEqual(nextContentRef, navviewlet.getNextItem(currentItem))
 def test_getPreviousURL_startFromSecondFile(self):
     currentfile = self.portal.file1
     navviewlet = NavigationViewlet(
         currentfile, {'compilationuid': IUUID(self.compilation)}, {}, None)
     navviewlet.update()
     prevURL = navviewlet.getPreviousURL()
     #/plone/file0?compilationuid=3b5cf1f3-10c1-4c29-a94c-53a915215262
     prevfile = self.portal.file0
     refurl = '%s?compilationuid=%s' % \
         ('/'.join(prevfile.getPhysicalPath()), IUUID(self.compilation))
     self.assertEqual(prevURL, refurl)
 def test_getNextURL(self):
     currentfile = self.portal.file0
     navviewlet = NavigationViewlet(
         currentfile, {'compilationuid': IUUID(self.compilation)}, {}, None)
     navviewlet.update()
     nexturl = navviewlet.getNextURL()
     #/plone/file1?compilationuid=3b5cf1f3-10c1-4c29-a94c-53a915215262
     nextfile = self.portal.file1
     refurl = '%s?compilationuid=%s' % \
         ('/'.join(nextfile.getPhysicalPath()), IUUID(self.compilation))
     self.assertEqual(nexturl, refurl)
 def setUp(self):
     super(TestNavigationViewlet, self).setUp()
     self.compilation = self.portal._getOb('compilation001')
     self.navviewlet = NavigationViewlet(self.compilation, {}, {}, None)
     self.navviewlet.update()