Пример #1
0
    def test_7_delete_item_list(self):
        for method in self.methods:
            factory = ItemListFactory(method, self.basedir)
            self.prepare(factory)
            factory.create_item_list("http://localhost:3000/item_lists/1",
                                     "first item list", "shared")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/1",
                "http://localhost:3000/catalog/cooee/items/1-010")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/1",
                "http://localhost:3000/catalog/cooee/items/1-011")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/1",
                "http://localhost:3000/catalog/cooee/items/1-012")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/1",
                "http://localhost:3000/catalog/cooee/items/1-013")
            factory.create_item_list("http://localhost:3000/item_lists/2",
                                     "second item list", "own")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/2",
                "http://localhost:3000/catalog/cooee/items/1-013")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/2",
                "http://localhost:3000/catalog/cooee/items/1-014")
            factory.add_to_item_list(
                "http://localhost:3000/item_lists/2",
                "http://localhost:3000/catalog/cooee/items/1-015")

            itemlists = factory.get_item_lists()
            listitemlists = []
            for status in ["shared", "own"]:
                listitemlists.extend(itemlists[status])
            hit = len(listitemlists)
            compare = 2
            self.assertEqual(hit, compare,
                             "expected %s item lists" % str(compare))

            hit = [itemlist["item_list_url"] for itemlist in listitemlists]
            compare = "http://localhost:3000/item_lists/1"
            self.assertIn(compare, hit,
                          "expected '%s' to be in the list" % compare)

            factory.delete_item_list("http://localhost:3000/item_lists/1")
            itemlists = factory.get_item_lists()
            listitemlists = []
            for status in ["shared", "own"]:
                listitemlists.extend(itemlists[status])
            hit = len(listitemlists)
            compare = 1
            self.assertEqual(hit, compare,
                             "expected %s item lists" % str(compare))

            hit = [itemlist["item_list_url"] for itemlist in listitemlists]
            compare = "http://localhost:3000/item_lists/1"
            self.assertNotIn(compare, hit,
                             "expected '%s' not to be in the list" % compare)
Пример #2
0
 def test_5_get_item_lists(self):
     for method in self.methods:
         factory = ItemListFactory(method, self.basedir)
         self.prepare(factory)
         factory.create_item_list("http://localhost:3000/item_lists/1", "first item list", "shared")
         factory.add_to_item_list("http://localhost:3000/item_lists/1", "http://localhost:3000/catalog/cooee/items/1-010")
         factory.add_to_item_list("http://localhost:3000/item_lists/1", "http://localhost:3000/catalog/cooee/items/1-011")
         factory.add_to_item_list("http://localhost:3000/item_lists/1", "http://localhost:3000/catalog/cooee/items/1-012")
         factory.add_to_item_list("http://localhost:3000/item_lists/1", "http://localhost:3000/catalog/cooee/items/1-013")
         factory.create_item_list("http://localhost:3000/item_lists/2", "second item list", "own")
         factory.add_to_item_list("http://localhost:3000/item_lists/2", "http://localhost:3000/catalog/cooee/items/1-013")
         factory.add_to_item_list("http://localhost:3000/item_lists/2", "http://localhost:3000/catalog/cooee/items/1-014")
         factory.add_to_item_list("http://localhost:3000/item_lists/2", "http://localhost:3000/catalog/cooee/items/1-015")
         
         itemlists = factory.get_item_lists()
         listitemlists = []
         for status in ["shared", "own"]:
             listitemlists.extend(itemlists[status])
         hit = len(listitemlists)
         compare = 2
         self.assertEqual(hit, compare, "expected %s item lists" % str(compare))
         
         hit = [itemlist["item_list_url"] for itemlist in listitemlists]
         compare = "http://localhost:3000/item_lists/1"
         self.assertIn(compare, hit, "expected '%s' to be in the list" % compare)
         
         compare = "http://localhost:3000/item_lists/3"
         self.assertNotIn(compare, hit, "expected '%s' not to be in the list" % compare)
Пример #3
0
 def test_1_empty_database(self):
     for method in self.methods:
         factory = ItemListFactory(method, self.basedir)
         self.prepare(factory)
         
         hit = factory.get_item_lists()
         compare = {"shared":[], "own":[]}
         self.assertEqual(hit, compare, "expected no item lists")
Пример #4
0
    def test_1_empty_database(self):
        for method in self.methods:
            factory = ItemListFactory(method, self.basedir)
            self.prepare(factory)

            hit = factory.get_item_lists()
            compare = {"shared": [], "own": []}
            self.assertEqual(hit, compare, "expected no item lists")