def test_activating_many_subscriptions_for_different_customers(self): gogol_music = Item(type=ItemType.SUBSCRIPTION, name='Gogol Music', price=10.0) spotofy = Item(type=ItemType.SUBSCRIPTION, name='Spotofy', price=10.0) john = Customer(name='John', surname='Smith', email_address='*****@*****.**') peter = Customer(name='Peter', surname='Smith', email_address='*****@*****.**') subscription_service.activate_subscription(john, gogol_music) subscription_service.activate_subscription(john, spotofy) subscription_service.activate_subscription(peter, gogol_music) subscription_service.activate_subscription(peter, spotofy) assert gogol_music in subscription_service.activated_subscriptions_for_customer( john) assert spotofy in subscription_service.activated_subscriptions_for_customer( john) assert gogol_music in subscription_service.activated_subscriptions_for_customer( peter) assert spotofy in subscription_service.activated_subscriptions_for_customer( peter)
def setUp(self): self.screwdriver = Item(type=ItemType.PHYSICAL, price=10.0, name='Screwdriver') self.hammer = Item(type=ItemType.PHYSICAL, price=5.0, name='Hammer') self.customer = Customer(name='John', surname='Smith', email_address='*****@*****.**') self.address = Address(zip_code='46001', street='C/ xxx')
def setUp(self): self.avator = Item(type=ItemType.DIGITAL_MEDIA, price=10.0, name='Avator') self.mission_possible = Item(type=ItemType.DIGITAL_MEDIA, price=5.0, name='Mission Possible') self.customer = Customer(name='John', surname='Smith', email_address='*****@*****.**') self.address = Address(zip_code='46001', street='C/ xxx')
def test_getting_the_subtotal_for_an_order_containing_many_units_of_many_items( self): screwdriver = Item(type=ItemType.PHYSICAL, price=10.0, name='Screwdriver') hammer = Item(type=ItemType.PHYSICAL, price=100.0, name='Hammer') order = Order(customer=self.customer, shipping_address=self.address, billing_address=self.address, items=[ OrderItems(item=screwdriver, quantity=3), OrderItems(item=hammer, quantity=1) ]) assert order.subtotal == 130.0
def test_order_reports_it_contains_a_digital_item(self): song = Item(type=ItemType.DIGITAL_MEDIA, price=10.0, name='Imagine') order = Order(customer=self.customer, shipping_address=self.address, billing_address=self.address, items=[OrderItems(item=song, quantity=3)]) assert order.contains_digital_media is True
def test_order_reports_it_contains_a_book(self): book = Item(type=ItemType.BOOK, price=10.0, name='Python for Dummies') order = Order(customer=self.customer, shipping_address=self.address, billing_address=self.address, items=[OrderItems(item=book, quantity=3)]) assert order.contains_books is True
def test_order_reports_it_contains_a_digital_subscription_item(self): gogol_music = Item(type=ItemType.SUBSCRIPTION, price=10.0, name='Gogol Music') order = Order(customer=self.customer, shipping_address=self.address, billing_address=self.address, items=[OrderItems(item=gogol_music, quantity=3)]) assert order.contains_subscriptions is True
def test_order_reports_it_contains_a_physical_item(self): screwdriver = Item(type=ItemType.PHYSICAL, price=10.0, name='Screwdriver') order = Order(customer=self.customer, shipping_address=self.address, billing_address=self.address, items=[OrderItems(item=screwdriver, quantity=3)]) assert order.contains_physical_items is True
def setUp(self): self.gogol_music = Item( type=ItemType.SUBSCRIPTION, price=5.0, name='Gogol Music' ) self.spotofy = Item( type=ItemType.SUBSCRIPTION, price=5.0, name='Spotofy' ) self.customer = Customer( name='John', surname='Smith', email_address='*****@*****.**' ) self.address = Address( zip_code='46001', street='C/ xxx' )
def setUp(self): self.screwdriver = Item(type=ItemType.PHYSICAL, price=10.0, name='Screwdriver') self.gogol_music = Item(type=ItemType.SUBSCRIPTION, price=5.0, name='Gogol Music') self.book = Item(type=ItemType.BOOK, price=5.0, name='Midnight') self.movie = Item(type=ItemType.DIGITAL_MEDIA, price=10.0, name='Mission Possible') self.customer = Customer(name='John', surname='Smith', email_address='*****@*****.**') self.address = Address(zip_code='46001', street='C/ xxx') self.tax_exempt_shipping_label = ShippingLabel( shipping_address=self.address, customer=self.customer, is_tax_exempt=True) self.regular_shipping_label = ShippingLabel( shipping_address=self.address, customer=self.customer)
def test_activating_a_subscription_for_a_customer(self): gogol_music = Item(type=ItemType.SUBSCRIPTION, name='Gogol Music', price=10.0) customer = Customer(name='John', surname='Smith', email_address='*****@*****.**') subscription_service.activate_subscription(customer, gogol_music) assert gogol_music in subscription_service.activated_subscriptions_for_customer( customer)