[Calypso] [PATCH 4/4] Test item removal
Guido Günther
agx at sigxcpu.org
Sat Apr 8 11:59:20 PDT 2017
---
tests/test_collection.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 26612e4..62a8d0a 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -22,6 +22,21 @@ class TestCollection(CalypsoTestCase):
org = u'Universitetet i Tromsø'
self.assertEquals(org, collection.items[0].object.org.value[0])
+ def test_remove_existent_item(self):
+ collection = Collection("")
+ self.assertTrue(collection.import_file(self.test_vcard))
+ self.assertEqual(len(collection.items), 2)
+ name = collection.items[0].name
+ collection.remove(name, {})
+ self.assertEqual(len(collection.items), 1)
+
+ def test_remove_nonexistent_item(self):
+ collection = Collection("")
+ self.assertTrue(collection.import_file(self.test_vcard))
+ self.assertEqual(len(collection.items), 2)
+ collection.remove("doesnotexist", {})
+ self.assertEqual(len(collection.items), 2)
+
def test_uid_with_slash(self):
collection = Collection("/")
self.assertTrue(collection.import_file(self.test_resource_with_slash))
@@ -31,3 +46,4 @@ class TestCollection(CalypsoTestCase):
c = paths.collection_from_path(veventuid)
self.assertEquals(r, veventuid)
self.assertEquals("/", c)
+
--
2.11.0
More information about the Calypso
mailing list