def test_gym_add_customer(self): Gym.id = 1 g = Gym() c = Customer("Pesho", "addr.", "*****@*****.**") g.add_customer(c) g.add_customer(c) self.assertEqual(g.customers, [c])
def test_customer_init(self): Customer.id = 1 c = Customer("Pesho", "addr.", "*****@*****.**") self.assertEqual(c.id, 1) self.assertEqual(c.name, "Pesho") self.assertEqual(c.address, "addr.") self.assertEqual(c.email, "*****@*****.**")
def test_gym_subscription_info(self): Gym.id = 1 Subscription.id = 1 ExercisePlan.id = 1 Equipment.id = 1 Trainer.id = 1 Customer.id = 1 g = Gym() s = Subscription("10.02.2020", 1, 1, 1) p = ExercisePlan(1, 1, 10) e = Equipment("Pesho") t = Trainer("Pesho") c = Customer("Pesho", "addr.", "*****@*****.**") g.add_subscription(s) g.add_customer(c) g.add_equipment(e) g.add_plan(p) g.add_trainer(t) self.assertEqual( g.subscription_info(1), "Subscription <1> on 10.02.2020\nCustomer <1> Pesho; Address: addr.; Email: [email protected]\nTrainer <1> Pesho\nEquipment <1> Pesho\nPlan <1> with duration 10 minutes" )
from Gym.customer import Customer from Gym.dvd import DVD from Gym.movie_world import MovieWorld c1 = Customer("John", 16, 1) c2 = Customer("Anna", 55, 2) d1 = DVD("Black Widow", 1, 2020, "April", 18) d2 = DVD.from_date(2, "The Croods 2", "23.12.2020", 3) movie_world = MovieWorld("The Best Movie Shop") movie_world.add_customer(c1) movie_world.add_customer(c2) movie_world.add_dvd(d1) movie_world.add_dvd(d2) print(movie_world.rent_dvd(1, 1)) print(movie_world.rent_dvd(2, 1)) print(movie_world.rent_dvd(1, 2)) print(movie_world)
def test_customer_repr(self): Customer.id = 1 c = Customer("Pesho", "addr.", "*****@*****.**") self.assertEqual( str(c), "Customer <1> Pesho; Address: addr.; Email: [email protected]")
def test_customer_static_method(self): Customer.id = 1 self.assertEqual(Customer.get_next_id(), 1)