def testSet1OnPortalRoot(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.portal.absolute_url() view = ContentViewsViewlet(self.portal, self.app.REQUEST, None) view.update() self.assertEqual(view.tabSet1[0]['id'], 'folderContents')
def test_set1_on_portal_root(self): self._invalidateRequestMemoizations() setRoles(self.portal, TEST_USER_ID, ['Manager', 'Member']) self.app.REQUEST['ACTUAL_URL'] = self.portal.absolute_url() view = ContentViewsViewlet(self.portal, self.app.REQUEST, None) view.update() self.assertEqual(view.tabSet1[0]['id'], 'folderContents')
def testPrepareObjectTabsDefaultView(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.folder.test.absolute_url() + '/edit' view = ContentViewsViewlet(self.folder.test, self.app.REQUEST, None) tabs = view.prepareObjectTabs() self.assertEqual(0, len([t for t in tabs if t['id'] == 'folderContents'])) self.assertEqual(['edit'], [t['id'] for t in tabs if t['selected']])
def testPrepareObjectTabsOnPortalRoot(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.portal.absolute_url() view = ContentViewsViewlet(self.portal, self.app.REQUEST, None) tabs = view.prepareObjectTabs() self.assertEqual(tabs[0]['id'], 'folderContents') self.assertEqual(['view'], [t['id'] for t in tabs if t['selected']])
def testPrepareObjectTabsNonFolder(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.folder.test.absolute_url() view = ContentViewsViewlet(self.folder.test, self.app.REQUEST, None) tabs = view.prepareObjectTabs() self.assertEqual(0, len([t for t in tabs if t['id'] == 'folderContents'])) self.assertEqual(['view'], [t['id'] for t in tabs if t['selected']])
def testPrepareObjectTabsNonStructuralFolder(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() directlyProvides(self.folder, INonStructuralFolder) view = ContentViewsViewlet(self.folder, self.app.REQUEST, None) tabs = view.prepareObjectTabs() noLongerProvides(self.folder, INonStructuralFolder) self.assertEqual(0, len([t for t in tabs if t['id'] == 'folderContents'])) self.assertEqual(['view'], [t['id'] for t in tabs if t['selected']])
def test_set1_NonStructuralFolder(self): self._invalidateRequestMemoizations() setRoles(self.portal, TEST_USER_ID, ['Manager', 'Member']) self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() directlyProvides(self.folder, INonStructuralFolder) view = ContentViewsViewlet(self.folder, self.app.REQUEST, None) view.update() noLongerProvides(self.folder, INonStructuralFolder) self.assertEqual( 1, len([t for t in view.tabSet1 if t['id'] == 'folderContents']))
def test_set1_NonStructuralFolder(self): self._invalidateRequestMemoizations() setRoles(self.portal, TEST_USER_ID, ['Manager', 'Member']) self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() directlyProvides(self.folder, INonStructuralFolder) view = ContentViewsViewlet(self.folder, self.app.REQUEST, None) view.update() noLongerProvides(self.folder, INonStructuralFolder) self.assertEqual(1, len([t for t in view.tabSet1 if t[ 'id'] == 'folderContents']))
def testSet1NonStructuralFolder(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() directlyProvides(self.folder, INonStructuralFolder) view = ContentViewsViewlet(self.folder, self.app.REQUEST, None) view.update() noLongerProvides(self.folder, INonStructuralFolder) self.assertEqual(1, len([t for t in view.tabSet1 if t[ 'id'] == 'folderContents']))
def testPrepareObjectTabsDefaultView(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = '%s/edit?_authenticator=%s' % ( self.folder.test.absolute_url(), auth.createToken()) view = ContentViewsViewlet(self.folder.test, self.app.REQUEST, None) tabs = view.prepareObjectTabs() self.assertEqual(0, len([t for t in tabs if t['id'] == 'folderContents'])) self.assertEqual(['edit'], [t['id'] for t in tabs if t['selected']])
def test_set1(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = '%s/edit?_authenticator=%s' % ( self.folder.test.absolute_url(), auth.createToken()) view = ContentViewsViewlet(self.folder.test, self.app.REQUEST, None) view.update() self.assertEqual( 1, len([t for t in view.tabSet1 if t['id'] == 'folderContents'])) self.assertEqual(['edit'], [t['id'] for t in view.tabSet1 if t['selected']])
def testPrepareObjectTabsNonStructuralFolder(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = self.folder.absolute_url() directlyProvides(self.folder, INonStructuralFolder) view = ContentViewsViewlet(self.folder, self.app.REQUEST, None) tabs = view.prepareObjectTabs() noLongerProvides(self.folder, INonStructuralFolder) self.assertEquals( 0, len([t for t in tabs if t['id'] == 'folderContents'])) self.assertEquals(['view'], [t['id'] for t in tabs if t['selected']])
def testSet1(self): self._invalidateRequestMemoizations() self.loginAsPortalOwner() self.app.REQUEST['ACTUAL_URL'] = '%s/edit?_authenticator=%s' % ( self.folder.test.absolute_url(), auth.createToken() ) view = ContentViewsViewlet(self.folder.test, self.app.REQUEST, None) view.update() self.assertEqual(1, len([t for t in view.tabSet1 if t[ 'id'] == 'folderContents'])) self.assertEqual(['edit'], [t['id'] for t in view.tabSet1 if t['selected']])