[Checkins] SVN: zope.app.container/trunk/ Removed a testing dependency on zope.app.file.

Hanno Schlichting hannosch at hannosch.eu
Tue Sep 14 08:11:23 EDT 2010


Log message for revision 116374:
  Removed a testing dependency on zope.app.file.
  

Changed:
  U   zope.app.container/trunk/CHANGES.txt
  U   zope.app.container/trunk/setup.py
  U   zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents_functional.py
  U   zope.app.container/trunk/src/zope/app/container/browser/tests/test_view_permissions.py
  U   zope.app.container/trunk/src/zope/app/container/ftesting.zcml

-=-
Modified: zope.app.container/trunk/CHANGES.txt
===================================================================
--- zope.app.container/trunk/CHANGES.txt	2010-09-14 11:39:52 UTC (rev 116373)
+++ zope.app.container/trunk/CHANGES.txt	2010-09-14 12:11:23 UTC (rev 116374)
@@ -5,6 +5,8 @@
 3.9.1 (unreleased)
 ------------------
 
+- Removed a testing dependency on zope.app.file.
+
 - Replaced a testing dependency on zope.app.securitypolicy with one on the base
   zope.securitypolicy distribution.
 

Modified: zope.app.container/trunk/setup.py
===================================================================
--- zope.app.container/trunk/setup.py	2010-09-14 11:39:52 UTC (rev 116373)
+++ zope.app.container/trunk/setup.py	2010-09-14 12:11:23 UTC (rev 116374)
@@ -50,7 +50,6 @@
 
       extras_require=dict(test=['zope.app.testing',
                                 'zope.app.zcmlfiles',
-                                'zope.app.file',
                                 'zope.login',
                                 'zope.securitypolicy',
                                 ]),

Modified: zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents_functional.py
===================================================================
--- zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents_functional.py	2010-09-14 11:39:52 UTC (rev 116373)
+++ zope.app.container/trunk/src/zope/app/container/browser/tests/test_contents_functional.py	2010-09-14 12:11:23 UTC (rev 116374)
@@ -78,9 +78,10 @@
     def test_inplace_add(self):
         root = self.getRootFolder()
         self.assert_('foo' not in root)
-        response = self.publish('/@@contents.html',
-                                basic='mgr:mgrpw',
-                                form={'type_name': u'zope.app.content.File'})
+        response = self.publish(
+            '/@@contents.html',
+            basic='mgr:mgrpw',
+            form={'type_name': u'BrowserAdd__zope.site.folder.Folder'})
         body = ' '.join(response.getBody().split())
         self.assert_(body.find('type="hidden" name="type_name"') >= 0)
         self.assert_(body.find('input name="new_value"') >= 0)
@@ -89,10 +90,11 @@
         self.assert_(body.find('type="submit" name="container_rename_button"')
                      < 0)
 
-        response = self.publish('/@@contents.html',
-                                basic='mgr:mgrpw',
-                                form={'type_name': u'zope.app.content.File',
-                                      'new_value': 'foo'})
+        response = self.publish(
+            '/@@contents.html',
+            basic='mgr:mgrpw',
+            form={'type_name': u'BrowserAdd__zope.site.folder.Folder',
+                  'new_value': 'foo'})
         self.assertEqual(response.getStatus(), 302)
         self.assertEqual(response.getHeader('Location'),
                          'http://localhost/@@contents.html')

Modified: zope.app.container/trunk/src/zope/app/container/browser/tests/test_view_permissions.py
===================================================================
--- zope.app.container/trunk/src/zope/app/container/browser/tests/test_view_permissions.py	2010-09-14 11:39:52 UTC (rev 116373)
+++ zope.app.container/trunk/src/zope/app/container/browser/tests/test_view_permissions.py	2010-09-14 12:11:23 UTC (rev 116374)
@@ -18,27 +18,28 @@
 import unittest
 import transaction
 
+from zope.annotation.interfaces import IAttributeAnnotatable
+from zope.interface import alsoProvides
 from zope.security.interfaces import Unauthorized
 
 from zope.app.testing.functional import BrowserTestCase
-from zope.app.file import File
+from zope.container.ordered import OrderedContainer
 from zope.dublincore.interfaces import IZopeDublinCore
 from zope.securitypolicy.interfaces import IRolePermissionManager
 from zope.app.container.testing import AppContainerLayer
 
+
 class Tests(BrowserTestCase):
 
     def test_default_view_permissions(self):
         """Tests the default view permissions.
-
-        See zope/app/securitypolicy/configure.zcml for the grants of
-        zope.View and zope.app.dublincore.view to zope.Anonymous. These
-        ensure that, by default, anonymous users can view container contents.
         """
         # add an item that can be viewed from the root folder
-        file = File()
-        self.getRootFolder()['file'] = file
-        IZopeDublinCore(file).title = u'My File'
+        obj = OrderedContainer()
+        alsoProvides(obj, IAttributeAnnotatable)
+
+        self.getRootFolder()['obj'] = obj
+        IZopeDublinCore(obj).title = u'My object'
         transaction.commit()
 
         response = self.publish('/')
@@ -46,10 +47,10 @@
         body = response.getBody()
 
         # confirm we can see the file name
-        self.assert_(body.find('<a href="file">file</a>') != -1)
+        self.assert_(body.find('<a href="obj">obj</a>') != -1)
 
         # confirm we can see the metadata title
-        self.assert_(body.find('<td><span>My File</span></td>') != -1)
+        self.assert_(body.find('<td><span>My object</span></td>') != -1)
 
     def test_deny_view(self):
         """Tests the denial of view permissions to anonymous.
@@ -73,10 +74,12 @@
         title, modified, and created info.
         """
         # add an item that can be viewed from the root folder
-        file = File()
-        self.getRootFolder()['file'] = file
-        IZopeDublinCore(file).title = u'My File'
+        obj = OrderedContainer()
+        alsoProvides(obj, IAttributeAnnotatable)
 
+        self.getRootFolder()['obj'] = obj
+        IZopeDublinCore(obj).title = u'My object'
+
         # deny zope.app.dublincore.view to zope.Anonymous
         prm = IRolePermissionManager(self.getRootFolder())
         prm.denyPermissionToRole('zope.dublincore.view', 'zope.Anonymous')
@@ -89,10 +92,10 @@
         body = response.getBody()
 
         # confirm we can see the file name
-        self.assert_(body.find('<a href="file">file</a>') != -1)
+        self.assert_(body.find('<a href="obj">obj</a>') != -1)
 
         # confirm we *cannot* see the metadata title
-        self.assert_(body.find('My File') == -1)
+        self.assert_(body.find('My object') == -1)
 
 
 def test_suite():

Modified: zope.app.container/trunk/src/zope/app/container/ftesting.zcml
===================================================================
--- zope.app.container/trunk/src/zope/app/container/ftesting.zcml	2010-09-14 11:39:52 UTC (rev 116373)
+++ zope.app.container/trunk/src/zope/app/container/ftesting.zcml	2010-09-14 12:11:23 UTC (rev 116374)
@@ -9,7 +9,6 @@
 
   <include package="zope.app.zcmlfiles" />
   <include package="zope.app.container.browser.tests" />
-  <include package="zope.app.file"/>
   <include package="zope.app.authentication" />
 
   <include package="zope.securitypolicy" file="meta.zcml" />



More information about the checkins mailing list