summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-001-contact_reference.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-20 09:20:19 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-07-20 09:20:19 +0200
commita91c6f384436c910e7f98dfbec5765026fe4e0c5 (patch)
tree99dad86dbc2acd480c6c8f621cd8904863eb1a48 /tests/unit/test-001-contact_reference.py
parent30ea265c66630f7961aa957ea8448086977f7a4f (diff)
downloadpykolab-a91c6f384436c910e7f98dfbec5765026fe4e0c5.tar.gz
Add some functional tests, move unit tests to separate directory
Diffstat (limited to 'tests/unit/test-001-contact_reference.py')
-rw-r--r--tests/unit/test-001-contact_reference.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/test-001-contact_reference.py b/tests/unit/test-001-contact_reference.py
new file mode 100644
index 0000000..7c8f128
--- /dev/null
+++ b/tests/unit/test-001-contact_reference.py
@@ -0,0 +1,30 @@
+import datetime
+import unittest
+
+from pykolab.xml import ContactReference
+
+class TestEventXML(unittest.TestCase):
+ contact_reference = ContactReference("jane@doe.org")
+
+ def assertIsInstance(self, _value, _type):
+ if hasattr(unittest.TestCase, 'assertIsInstance'):
+ return unittest.TestCase.assertIsInstance(self, _value, _type)
+ else:
+ if (type(_value)) == _type:
+ return True
+ else:
+ raise AssertionError, "%s != %s" % (type(_value), _type)
+
+ def test_001_minimal(self):
+ self.assertIsInstance(self.contact_reference.__str__(), str)
+
+ def test_002_empty_name(self):
+ self.assertEqual(self.contact_reference.get_name(), "")
+
+ def test_003_set_name(self):
+ name = "Doe, Jane"
+ self.contact_reference.set_name(name)
+ self.assertEqual(self.contact_reference.get_name(), name)
+
+if __name__ == '__main__':
+ unittest.main()