[Zope3-checkins] CVS: Products3/bugtracker/tests - test_tracker.py:1.4 test_xmlrpc.py:1.2

Stephan Richter srichter@cosmos.phy.tufts.edu
Mon, 28 Jul 2003 07:49:48 -0400


Update of /cvs-repository/Products3/bugtracker/tests
In directory cvs.zope.org:/tmp/cvs-serv23146/tests

Modified Files:
	test_tracker.py test_xmlrpc.py 
Log Message:
I finally got sick of using Folder as the base and implemented IContainer
myself and I think the result is good. I am now always using integers as 
ids and they are always generted for you.


=== Products3/bugtracker/tests/test_tracker.py 1.3 => 1.4 ===
--- Products3/bugtracker/tests/test_tracker.py:1.3	Mon Jul 28 06:21:12 2003
+++ Products3/bugtracker/tests/test_tracker.py	Mon Jul 28 07:49:44 2003
@@ -23,31 +23,40 @@
 from zope.app.dublincore.annotatableadapter import ZDCAnnotatableAdapter
 from zope.app.interfaces.annotation import IAnnotations, IAttributeAnnotatable
 from zope.app.interfaces.dublincore import IWriteZopeDublinCore
-from zope.app.container.tests.test_icontainer import DefaultTestData
+from zope.app.container.tests.test_icontainer import BaseTestIContainer
 from zope.component.adapter import provideAdapter
-from zope.component.tests.placelesssetup import PlacelessSetup
+from zopeproducts.bugtracker.tests.placelesssetup import PlacelessSetup
 from zope.interface import classImplements
 
 from zopeproducts.bugtracker.interfaces import IBugTracker
 from zopeproducts.bugtracker.tracker import BugTracker
+from zopeproducts.bugtracker.bug import Bug
 
 
-class TrackerTest(PlacelessSetup, BaseTestServiceManagerContainer,
-                  unittest.TestCase):
+class TrackerTest(PlacelessSetup, BaseTestIContainer,
+                  BaseTestServiceManagerContainer, unittest.TestCase):
 
     def setUp(self):
         PlacelessSetup.setUp(self)
-        classImplements(BugTracker, IAttributeAnnotatable)
-        provideAdapter(IAttributeAnnotatable, IAnnotations,
-                       AttributeAnnotations)
-        provideAdapter(IAttributeAnnotatable, IWriteZopeDublinCore,
-                       ZDCAnnotatableAdapter)
 
     def makeTestObject(self):
         return BugTracker()
 
     def makeTestData(self):
-        return DefaultTestData()
+        data = []
+        for name in range(10):
+            bug = Bug()
+            bug.title = u"Bug %i" %name
+            bug.description = u"This is bug %i." %name
+            data.append((name+1, bug))
+        return data
+
+    def getUnknownKey(self):
+        return 11
+
+    def getBadKeyTypes(self):
+        # We simply do not care what gets passed in
+        return []
 
     def test_Interface(self):
         self.failUnless(IBugTracker.isImplementedBy(self.makeTestObject()))


=== Products3/bugtracker/tests/test_xmlrpc.py 1.1 => 1.2 ===
--- Products3/bugtracker/tests/test_xmlrpc.py:1.1	Mon Jul 28 06:21:12 2003
+++ Products3/bugtracker/tests/test_xmlrpc.py	Mon Jul 28 07:49:44 2003
@@ -45,21 +45,21 @@
         self.methods = BugTrackerMethods(tracker, TestRequest())
 
     def test_getBugNames(self):
-        self.assertEqual(list(self.methods.getBugNames()), ['1', '2'])
+        self.assertEqual(list(self.methods.getBugNames()), [1, 2])
 
     def test_addBug(self):
         self.methods.addBug(u'Bug 3', u'This is bug 3.')
-        self.assertEqual(self.tracker['3'].title, u'Bug 3')
-        self.assertEqual(self.tracker['3'].description, u'This is bug 3.')
-        self.assertEqual(self.tracker['3'].status, u'new')
+        self.assertEqual(self.tracker[3].title, u'Bug 3')
+        self.assertEqual(self.tracker[3].description, u'This is bug 3.')
+        self.assertEqual(self.tracker[3].status, u'new')
         self.methods.addBug(u'Bug 4', u'This is bug 4.', owners=[u'jim'],
                             dependencies=['3'])
-        self.assertEqual(self.tracker['4'].dependencies, [u'3'])
-        self.assertEqual(self.tracker['4'].owners, [2])
+        self.assertEqual(self.tracker[4].dependencies, [u'3'])
+        self.assertEqual(self.tracker[4].owners, [2])
 
     def test_deleteBug(self):
-        self.methods.deleteBug('2')
-        self.assertEqual(list(self.tracker), ['1'])
+        self.methods.deleteBug(2)
+        self.assertEqual(list(self.tracker), [1])
 
 
 class BugMethodsTest(PlacelessSetup, unittest.TestCase):