def test_subscription_init(self): Subscription.id = 1 s = Subscription("20.02.2020", 1, 1, 1) self.assertEqual(s.id, 1) self.assertEqual(s.date, "20.02.2020") self.assertEqual(s.customer_id, 1) self.assertEqual(s.trainer_id, 1) self.assertEqual(s.exercise_id, 1)
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")
def test_subscription_static_method(self): Subscription.id = 1 self.assertEqual(Subscription.get_next_id(), 1)
def test_gym_add_subscription(self): g = Gym() s = Subscription("10.02.2020", 1, 1, 1) g.add_subscription(s) g.add_subscription(s) self.assertEqual(g.subscriptions, [s])
from project.customer import Customer from project.equipment import Equipment from project.exercise_plan import ExercisePlan from project.gym import Gym from project.subscription import Subscription from project.trainer import Trainer customer = Customer("John", "Maple Street", "*****@*****.**") equipment = Equipment("Treadmill") trainer = Trainer("Peter") subscription = Subscription("14.05.2020", 1, 1, 1) plan = ExercisePlan(1, 1, 20) gym = Gym() gym.add_customer(customer) gym.add_equipment(equipment) gym.add_trainer(trainer) gym.add_plan(plan) gym.add_subscription(subscription) print(Customer.get_next_id()) print(gym.subscription_info(1)) # c = Customer("Sofia", "Lozen", "*****@*****.**") # print(c) # # m = Customer("Sofia", "Lozen", "*****@*****.**") # print(c) # print(m)
from project.customer import Customer from project.equipment import Equipment from project.exercise_plan import ExercisePlan from project.gym import Gym from project.subscription import Subscription from project.trainer import Trainer customer = Customer("John", "Maple Street", "*****@*****.**") customer2 = Customer("Atanas", "test", "*****@*****.**") equipment = Equipment("Treadmill") equipment2 = Equipment("Push Ups") trainer = Trainer("Peter") trainer2 = Trainer("Gosho") subscription = Subscription("14.05.2020", 1, 1, 1) subscription2 = Subscription("05.11.2020", 2, 2, 2) plan = ExercisePlan(1, 1, 20) plan2 = ExercisePlan.from_hour(2, 2, 3) gym = Gym() gym.add_customer(customer2) gym.add_equipment(equipment2) gym.add_trainer(trainer2) gym.add_plan(plan2) gym.add_subscription(subscription2) # print(Customer.get_next_id()) # # print(gym.subscription_info(1)) print(gym.subscription_info(2))