[Zope3-checkins] CVS: Products3/bugtracker/tests - test_xmlexportimport.py:1.2
Stephan Richter
srichter@cosmos.phy.tufts.edu
Sat, 26 Jul 2003 18:46:50 -0400
Update of /cvs-repository/Products3/bugtracker/tests
In directory cvs.zope.org:/tmp/cvs-serv5071/tests
Modified Files:
test_xmlexportimport.py
Log Message:
Fixed tests based on last changes.
=== Products3/bugtracker/tests/test_xmlexportimport.py 1.1 => 1.2 ===
--- Products3/bugtracker/tests/test_xmlexportimport.py:1.1 Sat Jul 26 09:40:49 2003
+++ Products3/bugtracker/tests/test_xmlexportimport.py Sat Jul 26 18:46:46 2003
@@ -26,12 +26,17 @@
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.interfaces.annotation import IAnnotations, IAttributeAnnotatable
from zope.app.interfaces.dublincore import IWriteZopeDublinCore
+from zope.app.interfaces.security import IAuthenticationService
from zope.app.interfaces.traversing import IContainmentRoot
from zope.app.interfaces.traversing import ITraversable, IPhysicallyLocatable
+from zope.app.security.registries.principalregistry \
+ import principalRegistry
+from zope.app.services.servicenames import Authentication
from zope.app.traversing.adapters import DefaultTraversable
from zope.app.traversing.adapters import WrapperPhysicallyLocatable
from zope.component import getAdapter
from zope.component.adapter import provideAdapter
+from zope.component.service import defineService, serviceManager
from zope.component.tests.placelesssetup import PlacelessSetup
from zope.interface import classImplements, implements
from zope.schema.vocabulary import getVocabularyRegistry
@@ -44,6 +49,8 @@
from zopeproducts.bugtracker.tracker import BugTracker
from zopeproducts.bugtracker.vocabulary import \
StatusVocabulary, PriorityVocabulary, BugTypeVocabulary, ReleaseVocabulary
+from zopeproducts.bugtracker.vocabulary import UserVocabulary
+
class Root(object):
@@ -69,6 +76,15 @@
registry.register('Priorities', PriorityVocabulary)
registry.register('BugTypes', BugTypeVocabulary)
registry.register('Releases', ReleaseVocabulary)
+ registry.register('Users', UserVocabulary)
+
+ defineService(Authentication, IAuthenticationService)
+ serviceManager.provideService(Authentication, principalRegistry)
+
+ principalRegistry.definePrincipal(1, 'Stephan Richter', '',
+ 'srichter', 'foo')
+ principalRegistry.definePrincipal(2, 'Jim Fulton', '',
+ 'jim', 'bar')
tracker = ContextWrapper(BugTracker(), Root(), name='tracker')
file = os.path.join(os.path.split(tests.__file__)[0], 'tracker.xml')
@@ -87,7 +103,7 @@
self.assertEqual(bug.priority, u'urgent')
self.assertEqual(bug.type, u'bug')
self.assertEqual(bug.release, u'None')
- self.assertEqual(bug.owners, [u'jim', u'srichter'])
+ self.assertEqual(bug.owners, [1, 2])
dc = getAdapter(bug, IZopeDublinCore)
self.assertEqual(dc.created, parseDatetimetz(u'2003-01-01T23:00:00'))
self.assertEqual(dc.modified, parseDatetimetz(u'2003-01-02T23:00:00'))
@@ -125,13 +141,20 @@
provideAdapter(None, IPhysicallyLocatable, WrapperPhysicallyLocatable)
provideAdapter(None, ITraversable, DefaultTraversable)
+ defineService(Authentication, IAuthenticationService)
+ serviceManager.provideService(Authentication, principalRegistry)
+ principalRegistry.definePrincipal(1, 'Stephan Richter', '',
+ 'srichter', 'foo')
+ principalRegistry.definePrincipal(2, 'Jim Fulton', '',
+ 'jim', 'bar')
registry = getVocabularyRegistry()
registry.register('Stati', StatusVocabulary)
registry.register('Priorities', PriorityVocabulary)
registry.register('BugTypes', BugTypeVocabulary)
registry.register('Releases', ReleaseVocabulary)
+ registry.register('Users', UserVocabulary)
tracker = ContextWrapper(BugTracker(), Root(), name='tracker')
file = os.path.join(os.path.split(tests.__file__)[0], 'tracker.xml')
@@ -162,7 +185,8 @@
self.assert_('priority="urgent"' in self.xml)
self.assert_('type="bug"' in self.xml)
self.assert_('release="None' in self.xml)
- self.assert_('owners="jim, srichter' in self.xml)
+ self.assert_('owners="jim, srichter' in self.xml or
+ 'owners="srichter, jim' in self.xml)
self.assert_('dependencies=""' in self.xml)
self.assert_('created="Jan 1, 2003 11:00:00 PM "' in self.xml)
self.assert_('modified="Jan 2, 2003 11:00:00 PM "' in self.xml)