[Galago-commits] r2637 - in trunk/galago-python: . tests

galago-commits at freedesktop.org galago-commits at freedesktop.org
Wed Mar 29 01:59:49 PST 2006


Author: chipx86
Date: 2006-03-29 01:59:37 -0800 (Wed, 29 Mar 2006)
New Revision: 2637

Added:
   trunk/galago-python/tests/unittests.py
Modified:
   trunk/galago-python/ChangeLog
Log:
Add some unit tests. These will eventually test everything that the unit tests in libgalago test, plus some.


Modified: trunk/galago-python/ChangeLog
===================================================================
--- trunk/galago-python/ChangeLog	2006-03-29 09:57:15 UTC (rev 2636)
+++ trunk/galago-python/ChangeLog	2006-03-29 09:59:37 UTC (rev 2637)
@@ -1,3 +1,9 @@
+Wed Mar 29 01:58:46 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	A tests/unittests.py:
+	  - Add some unit tests. These will eventually test everything that
+	    the unit tests in libgalago test, plus some.
+
 Fri Mar 24 00:45:40 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/galago.defs:

Added: trunk/galago-python/tests/unittests.py
===================================================================
--- trunk/galago-python/tests/unittests.py	2006-03-29 09:57:15 UTC (rev 2636)
+++ trunk/galago-python/tests/unittests.py	2006-03-29 09:59:37 UTC (rev 2637)
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+import unittest
+import galago
+
+
+def makeDummyPerson(id="dummy-person"):
+    return galago.create_person(id)
+
+
+class BaseTestCase(unittest.TestCase):
+    def setUp(self):
+        self.failUnless(galago.init("check-galago-python", True))
+
+    def tearDown(self):
+        galago.uninit()
+
+
+class InitTestCase(BaseTestCase):
+    def setUp(self):
+        # Don't init the feed yet.
+        pass
+
+    def testInitReinit(self):
+        self.failUnless(galago.init("check-galago-python", False))
+        galago.uninit()
+        self.failUnless(galago.init("check-galago-python", False))
+
+
+class ObjectTestCase(BaseTestCase):
+    def testCreatePerson(self):
+        self.__checkObject(galago.create_person("dummy-person"))
+        self.__checkObject(galago.create_person())
+
+    def testCreateService(self):
+        self.__checkObject(galago.create_service("dummy-service-1",
+                                                 "Dummy Service 1", 0))
+        self.__checkObject(galago.create_service("dummy-service-2",
+                                                 "Dummy Service 2"))
+
+#    def testCreateAccount(self):
+#        person = galago.create_person("dummy-person-x")
+#        service = galago.create_service("dummy-service-x", "Dummy Service")
+#        self.failUnless(person != None)
+#        self.failUnless(service != None)
+#        self.__checkObject(service.create_account(person, "dummy-account"))
+
+    def __checkObject(self, obj):
+        self.failUnless(obj != None)
+        self.failUnless(obj.get_dbus_path() != "")
+
+
+def suite():
+    return unittest.TestSuite((
+        unittest.makeSuite(InitTestCase),
+        unittest.makeSuite(ObjectTestCase)
+    ))
+
+
+if __name__ == '__main__':
+    unittest.main()
+    print "Done"


Property changes on: trunk/galago-python/tests/unittests.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the galago-commits mailing list