[Zope3-checkins] CVS: Zope3/src/zope/app/tests - test_clipboard.py:1.1.2.3

runyaga runyaga@thisbox.com
Wed, 5 Feb 2003 09:14:27 -0500


Update of /cvs-repository/Zope3/src/zope/app/tests
In directory cvs.zope.org:/tmp/cvs-serv7115

Modified Files:
      Tag: paris-copypasterename-branch
	test_clipboard.py 
Log Message:
clipboard tests work


=== Zope3/src/zope/app/tests/test_clipboard.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/tests/test_clipboard.py:1.1.2.2	Wed Feb  5 07:43:04 2003
+++ Zope3/src/zope/app/tests/test_clipboard.py	Wed Feb  5 09:14:23 2003
@@ -20,20 +20,38 @@
 from zope.app.interfaces.copy import IPrincipalClipboard
 from zope.app.copy import PrincipalClipboard
 from zope.app.interfaces.services.auth import IUser
-from zope.component import getAdapter
+from zope.component import getAdapter, getService, getServiceManager
 from zope.component.adapter import provideAdapter
-
-class PrincipalClipboardTest(AuthSetup, TestCase):
+from zope.app.services.principalannotation \
+    import PrincipalAnnotationService
+from zope.app.interfaces.services.principalannotation \
+    import IPrincipalAnnotationService
+from zope.app.services.tests.placefulsetup \
+    import PlacefulSetup
+from zope.app.interfaces.annotation import IAnnotations
+ 
+class PrincipalClipboardTest(AuthSetup, PlacefulSetup, TestCase):
     
     def setUp(self):
         AuthSetup.setUp(self)
-        provideAdapter(IUser, IPrincipalClipboard, PrincipalClipboard)
+        PlacefulSetup.setUp(self)
+        self.buildFolders()
+
+        provideAdapter(IAnnotations, IPrincipalClipboard, PrincipalClipboard)
+        root_sm = getServiceManager(None)
+        svc = PrincipalAnnotationService()
+        root_sm.defineService("PrincipalAnnotation", \
+            IPrincipalAnnotationService) 
+        root_sm.provideService("PrincipalAnnotation", svc)
+        sm = getServiceManager(self.rootFolder)
+        sm.PrincipalAnnotation = svc
+        self.svc = getService(self.rootFolder, "PrincipalAnnotation")
 
     def testAddItems(self):
         auth = self._auth
         user = auth.getPrincipalByLogin('srichter')
 
-        annotationsvc = getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = getService(self, 'PrincipalAnnotation')
         annotations = annotationsvc.getAnnotation(user)
         clipboard = getAdapter(annotations, IPrincipalClipboard)
         clipboard.addItems('move', ['bla', 'bla/foo', 'bla/bar'])
@@ -50,7 +68,7 @@
         auth = self._auth
         user = auth.getPrincipalByLogin('srichter')
 
-        annotationsvc = getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = getService(self, 'PrincipalAnnotation')
         annotations = annotationsvc.getAnnotation(user)
         clipboard = getAdapter(annotations, IPrincipalClipboard)
 
@@ -66,14 +84,14 @@
     def testClearContents(self):
         auth = self._auth
         user = auth.getPrincipalByLogin('srichter')
-        annotationsvc = getService(self.context, 'PrincipalAnnotation')
+        annotationsvc = getService(self, 'PrincipalAnnotation')
         annotations = annotationsvc.getAnnotation(user)
         clipboard = getAdapter(annotations, IPrincipalClipboard)
         clipboard.clearContents()
         self.failUnless(clipboard.getContents() == ())
 
 def test_suite():
-    t1 = makeSuite(AnnotatableUserClipboardTest)
+    t1 = makeSuite(PrincipalClipboardTest)
     return TestSuite((t1,))
 
 if __name__=='__main__':