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))
def test_6_change_item_list_shared(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") hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["shared"] compare = "shared" self.assertEqual( hit, compare, "Expected shared status of the item list to be %s" % compare) factory.unshare_item_list("http://localhost:3000/item_lists/1") hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["shared"] compare = "own" self.assertEqual( hit, compare, "Expected shared status of the item list to be %s" % compare) factory.share_item_list("http://localhost:3000/item_lists/1") hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["shared"] compare = "shared" self.assertEqual( hit, compare, "Expected shared status of the item list to be %s" % compare)
def test_2_create_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") hit = factory.get_item_list("http://localhost:3000/item_lists/1")["name"] compare = "first item list" self.assertEqual(hit, compare, "expected the name of the itemlist to be '%s'" % compare) hit = factory.get_item_list("http://localhost:3000/item_lists/1")["shared"] compare = "shared" self.assertEqual(hit, compare, "expected the shared status of the itemlist to be '%s'" % compare)
def test_3_empty_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") hit = factory.get_item_list("http://localhost:3000/item_lists/1")["num_items"] compare = 0 self.assertEqual(hit, compare, "expected the itemlist to have %s items" % str(compare))
def test_10_rename_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.rename_item_list("http://localhost:3000/item_lists/1", "this is a new name") hit = factory.get_item_list("http://localhost:3000/item_lists/1")["name"] compare = "this is a new name" self.assertEqual(hit, compare, "Expected %s, got %s" %(compare, hit))
def test_6_change_item_list_shared(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") hit = factory.get_item_list("http://localhost:3000/item_lists/1")["shared"] compare = "shared" self.assertEqual(hit, compare, "Expected shared status of the item list to be %s" % compare) factory.unshare_item_list("http://localhost:3000/item_lists/1") hit = factory.get_item_list("http://localhost:3000/item_lists/1")["shared"] compare = "own" self.assertEqual(hit, compare, "Expected shared status of the item list to be %s" % compare) factory.share_item_list("http://localhost:3000/item_lists/1") hit = factory.get_item_list("http://localhost:3000/item_lists/1")["shared"] compare = "shared" self.assertEqual(hit, compare, "Expected shared status of the item list to be %s" % compare)
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))
def test_2_create_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") hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["name"] compare = "first item list" self.assertEqual( hit, compare, "expected the name of the itemlist to be '%s'" % compare) hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["shared"] compare = "shared" self.assertEqual( hit, compare, "expected the shared status of the itemlist to be '%s'" % compare)
def test_3_empty_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") hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["num_items"] compare = 0 self.assertEqual( hit, compare, "expected the itemlist to have %s items" % str(compare))
def test_10_rename_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.rename_item_list("http://localhost:3000/item_lists/1", "this is a new name") hit = factory.get_item_list( "http://localhost:3000/item_lists/1")["name"] compare = "this is a new name" self.assertEqual(hit, compare, "Expected %s, got %s" % (compare, hit))
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)
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)