示例#1
0
    def test_1(self):
        first_product = Product(1, "Lemon", "Fresh lemons", 3, 10)
        first_customer = Customer("Mohammad", 31343, True)
        first_store = Store()

        test_bool = first_customer.is_premium_member()
        self.assertTrue(test_bool)
示例#2
0
    def test_5(self):
        p1 = Product("111", "Orange Juice", "Off Brand OJ with pulp", 3.99, 3)
        c1 = Customer("Jun", "ABC", False)
        myStore = Store()
        myStore.add_product(p1)
        myStore.add_member(c1)
        myStore.add_product_to_member_cart("111", "ABC")
        result = myStore.check_out_member("ABC")

        self.assertFalse(c1.is_premium_member())
示例#3
0
    def test_customer(self):
        """
        tests the basic functionality of the Customer class
        """
        c1 = Customer("Yinsheng", "QWF", False)

        self.assertEqual(c1.get_name(), "Yinsheng")
        self.assertEqual(c1.get_customer_id(), "QWF")
        self.assertFalse(c1.is_premium_member())

        c1.add_product_to_cart("101")
        c1.add_product_to_cart("889")

        self.assertDictEqual(c1.get_cart(), {"889": 1, "101": 1})

        c1.add_product_to_cart("101")
        c1.add_product_to_cart("889")

        self.assertDictEqual(c1.get_cart(), {"101": 2, "889": 2})

        c1.empty_cart()

        self.assertEqual(c1.get_cart(), {})