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

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Mar 8 07:53:41 EST 2004


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

Modified Files:
	test_clipboard.py 
Log Message:


This test used the test base from auth. Changed it to use pluggable auth.


=== Zope3/src/zope/app/tests/test_clipboard.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/tests/test_clipboard.py:1.9	Sat Mar  6 11:50:31 2004
+++ Zope3/src/zope/app/tests/test_clipboard.py	Mon Mar  8 07:53:40 2004
@@ -1,4 +1,3 @@
-from zope.app.services.tests.test_auth import AuthSetup
 ##############################################################################
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
@@ -12,44 +11,45 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
+"""Clipboard tests
+
 $Id$
 """
 from unittest import TestCase, TestSuite, main, makeSuite
-from zope.app.copypastemove.interfaces import IPrincipalClipboard
-from zope.app.copypastemove import PrincipalClipboard
-from zope.component import getService, getServiceManager
+
+from zope.app import zapi
 from zope.app.tests import ztapi
-from zope.app.services.principalannotation \
-    import PrincipalAnnotationService
+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):
+from zope.app.copypastemove.interfaces import IPrincipalClipboard
+from zope.app.copypastemove import PrincipalClipboard
+from zope.app.services.pluggableauth.tests.authsetup import AuthSetup
+
+
+class PrincipalClipboardTest(AuthSetup, TestCase):
 
     def setUp(self):
         AuthSetup.setUp(self)
-        PlacefulSetup.setUp(self)
         self.buildFolders()
 
         ztapi.provideAdapter(IAnnotations, IPrincipalClipboard,
                              PrincipalClipboard)
-        root_sm = getServiceManager(None)
+        root_sm = zapi.getServiceManager(None)
         svc = PrincipalAnnotationService()
         root_sm.defineService("PrincipalAnnotation", \
             IPrincipalAnnotationService)
         root_sm.provideService("PrincipalAnnotation", svc)
-        sm = getServiceManager(self.rootFolder)
+        sm = zapi.getServiceManager(self.rootFolder)
         sm.PrincipalAnnotation = svc
-        self.svc = getService(self.rootFolder, "PrincipalAnnotation")
+        self.svc = zapi.getService(self.rootFolder, "PrincipalAnnotation")
 
     def testAddItems(self):
-        auth = self._auth
-        user = auth.getPrincipalByLogin('srichter')
+        user = self._auth['one']['srichter']
 
-        annotationsvc = getService(self, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService(self, 'PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         clipboard.addItems('move', ['bla', 'bla/foo', 'bla/bar'])
@@ -63,10 +63,9 @@
         self.failUnless(clipboard.getContents() == expected)
 
     def testSetContents(self):
-        auth = self._auth
-        user = auth.getPrincipalByLogin('srichter')
+        user = self._auth['one']['srichter']
 
-        annotationsvc = getService(self, 'PrincipalAnnotation')
+        annotationsvc = zapi.getService(self, 'PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
 
@@ -80,9 +79,9 @@
         self.failUnless(clipboard.getContents() == expected)
 
     def testClearContents(self):
-        auth = self._auth
-        user = auth.getPrincipalByLogin('srichter')
-        annotationsvc = getService(self, 'PrincipalAnnotation')
+        user = self._auth['one']['srichter']
+
+        annotationsvc = zapi.getService(self, 'PrincipalAnnotation')
         annotations = annotationsvc.getAnnotations(user)
         clipboard = IPrincipalClipboard(annotations)
         clipboard.clearContents()




More information about the Zope3-Checkins mailing list