def check_products(self): cat = Category() assert len(cat.products) == 0, \ ".products should be empty list by default" self.cur.execute("DELETE FROM base_node") self.cur.execute("DELETE FROM shop_product") self.cur.execute("DELETE FROM shop_product_node") self.cur.execute("INSERT INTO base_node (name) values ('whatever')") self.cur.execute("INSERT INTO shop_product (code, name) " "VALUES ('a', 'ant')") self.cur.execute("INSERT INTO shop_product (code, name) " "VALUES ('b', 'box')") self.cur.execute("INSERT INTO shop_product (code, name) " "VALUES ('c', 'car')") self.cur.execute("INSERT INTO shop_product_node (productID, nodeID) " "VALUES (1, 1)") self.cur.execute("INSERT INTO shop_product_node (productID, nodeID) " "VALUES (2, 1)") self.cur.execute("INSERT INTO shop_product_node (productID, nodeID) " "VALUES (3, 1)") prods = clerk.fetch(Category, ID=1).products assert len(prods) == 3, \ "wrong number of categories (%s) shown on category page" \ % len(prods)
def check_products(self): cat = Category() assert len(cat.products) == 0, ".products should be empty list by default" self.cur.execute("DELETE FROM base_node") self.cur.execute("DELETE FROM shop_product") self.cur.execute("DELETE FROM shop_product_node") self.cur.execute("INSERT INTO base_node (name) values ('whatever')") self.cur.execute("INSERT INTO shop_product (code, name) " "VALUES ('a', 'ant')") self.cur.execute("INSERT INTO shop_product (code, name) " "VALUES ('b', 'box')") self.cur.execute("INSERT INTO shop_product (code, name) " "VALUES ('c', 'car')") self.cur.execute("INSERT INTO shop_product_node (productID, nodeID) " "VALUES (1, 1)") self.cur.execute("INSERT INTO shop_product_node (productID, nodeID) " "VALUES (2, 1)") self.cur.execute("INSERT INTO shop_product_node (productID, nodeID) " "VALUES (3, 1)") prods = clerk.fetch(Category, ID=1).products assert len(prods) == 3, "wrong number of categories (%s) shown on category page" % len(prods)
def check_product(self): #@TODO: what's up with this test? # maybe it just tries not to get an error? style = clerk.fetch(Style, ID=2) prod = style.product