def test_user_can_setup_shave_and_gel_as_product_once_a_month_as_shipping_interval_start_date_14_jan_2017_to_14_jan_2017_spend_money_is_9(self): product = ProductBuilder().withTitle("Shave + Gel").withPrice(9).create() subscribing = Subscribing(product, OnceTwoMonth(14)) subscribing.startDate = date(2017, 1, 14) user = User(subscribing, date(2017, 1, 10)) user.updateCurrentDate(date(2017, 1, 14)) self.assertEqual(user.spendCash, 9)
def test_UserSpendMoneyReturn54USD_When_SubscribingConsistOf_ShaveAndGelAsProduct_OnceTwoMonthAsShippingInterval_StartDate14Jan2017_Today13Jan2018(self): product = ProductBuilder().withTitle("Shave+Gel").withPrice(9).create() interval = OnceTwoMonth(14) user = User() subscribing = Subscribing(user, product, interval, date(2017, 1, 14)) subscribing.calculatePaymentTo(date(2018, 1, 13)) self.assertEqual(user.spendCash, 54)
def test_UserSpendMoneyReturn2USD_When_SubscribingConsistOf_ShaveAsProduct_OnceAMonthAsShippingInterval_StartDate14Jan2017_Today15Feb2017(self): product = ProductBuilder().withTitle("Shave").withPrice(1).create() interval = OnceAMonth(14) user = User() subscribing = Subscribing(user, product, interval, date(2017, 1, 14)) subscribing.calculatePaymentTo(date(2017, 2, 15)) self.assertEqual(user.spendCash, 2)
def test_UserSpendMoneyReturn3USD_When_SubscribingConsistOf_ShaveAsProduct_OnceAMonthAsShippingInterval_StartDate14Jan2017_Today26Feb2017_ChangeIntervalTo_TwiceAMonth_Day_10_25_StartDate_1Feb2017(self): product = ProductBuilder().withTitle("Shave").withPrice(1).create() interval = OnceAMonth(14) user = User() subscribing = Subscribing(user, product, interval, date(2017, 1, 14)) subscribing.calculatePaymentTo(date(2017, 2, 1)) subscribing.setInterval(TwiceAMonth(10, 25)) subscribing.calculatePaymentTo(date(2017, 2, 26)) self.assertEqual(user.spendCash, 3)
def test_UserSpendMoneyReturn7USD_When_SubscribingConsistOf_ShaveAsProduct_OnceTwoMonthAsShippingInterval_StartDate14Feb2017_Today15Apr2018_StopSubscribing_25Mar2018(self): product = ProductBuilder().withTitle("Shave").withPrice(1).create() interval = OnceTwoMonth(14) user = User() subscribing = Subscribing(user, product, interval, date(2017, 2, 14)) subscribing.calculatePaymentTo(date(2018, 3, 25)) subscribing.stop() subscribing.calculatePaymentTo(date(2018, 4, 15)) self.assertEqual(user.spendCash, 7)
def test_user_can_deactivate_subscribing(self): product = ProductBuilder().withTitle("Shave + Gel + Aftershaves").create() subscribing = Subscribing(product, OnceTwoMonth(1)) user = User(subscribing) self.assertEqual(subscribing.isActive, False)
def test_user_can_setup_once_two_month_as_shipping_interval_of_subscribing(self): product = ProductBuilder().withTitle("Shave + Gel + Aftershaves").create() subscribing = Subscribing(product, OnceTwoMonth(1)) user = User(subscribing) self.assertEqual(user.subscribing.interval.title, "Once Two Month")
def test_user_can_setup_Shave_and_Gel_and_Aftershaves_as_product_of_subscribing(self): product = ProductBuilder().withTitle("Shave + Gel + Aftershaves").create() subscribing = Subscribing(product) user = User(subscribing) self.assertEqual(user.subscribing.product.title, "Shave + Gel + Aftershaves")