Exemplo n.º 1
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)
Exemplo n.º 2
0
    def test_8_clear_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")

            items = factory.get_item_list(
                "http://localhost:3000/item_lists/1")["items"]
            hit = len(items)
            compare = 4
            self.assertEqual(
                hit, compare,
                "Expected the size of the list to be %s" % str(compare))

            factory.clear_item_list("http://localhost:3000/item_lists/1")
            items = factory.get_item_list(
                "http://localhost:3000/item_lists/1")["items"]
            hit = len(items)
            compare = 0
            self.assertEqual(
                hit, compare,
                "Expected the size of the list to be %s" % str(compare))
Exemplo n.º 3
0
    def test_8_clear_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")

            items = factory.get_item_list("http://localhost:3000/item_lists/1")["items"]
            hit = len(items)
            compare = 4
            self.assertEqual(hit, compare, "Expected the size of the list to be %s" % str(compare))
            
            factory.clear_item_list("http://localhost:3000/item_lists/1")
            items = factory.get_item_list("http://localhost:3000/item_lists/1")["items"]
            hit = len(items)
            compare = 0
            self.assertEqual(hit, compare, "Expected the size of the list to be %s" % str(compare))
Exemplo n.º 4
0
 def test_4_add_items(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")
         
         itemlist = factory.get_item_list("http://localhost:3000/item_lists/1")
         hit = itemlist["num_items"]
         compare = 4
         self.assertEqual(hit, compare, "expected the itemlist to have %s items" % str(compare))
         
         hit = itemlist["items"]
         compare = "http://localhost:3000/catalog/cooee/items/1-010"
         self.assertIn(compare, hit, "expected '%s' to be in the items" % compare)
         
         hit = itemlist["items"]
         compare = "http://localhost:3000/catalog/cooee/items/1-015"
         self.assertNotIn(compare, hit, "expected '%s' not to be in the items" % compare)
Exemplo n.º 5
0
    def test_4_add_items(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")

            itemlist = factory.get_item_list(
                "http://localhost:3000/item_lists/1")
            hit = itemlist["num_items"]
            compare = 4
            self.assertEqual(
                hit, compare,
                "expected the itemlist to have %s items" % str(compare))

            hit = itemlist["items"]
            compare = "http://localhost:3000/catalog/cooee/items/1-010"
            self.assertIn(compare, hit,
                          "expected '%s' to be in the items" % compare)

            hit = itemlist["items"]
            compare = "http://localhost:3000/catalog/cooee/items/1-015"
            self.assertNotIn(compare, hit,
                             "expected '%s' not to be in the items" % compare)
Exemplo n.º 6
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)