def __init__(self, name, age, avatar, password): self.name = name self.age = age self.avatar = avatar self.password = password self.subscriptions = [] self.__life_time = 0 self.dead = False self.__notifier = Decorator.ConcreteNotifier() self.notify_inside_network = False self.notify_email = False self.notify_telegram = False self.notify_whats_app = False self.notify_viber = False
def test_decorator(self): self.assertEqual(Decorator.decorator(3), 8) self.assertEqual(Decorator.decorator(8), 13) self.assertEqual(Decorator.decorator(3), 8) self.assertEqual(Decorator.decorator(0), 5)
def notification_whats_app_on(self): self.__notifier = Decorator.OnWhatsAppDecorator(self.__notifier) self.notify_whats_app = True
def notification_viber_on(self): self.__notifier = Decorator.OnViberDecorator(self.__notifier) self.notify_viber = True
def notification_telegram_on(self): self.__notifier = Decorator.OnTelegramDecorator(self.__notifier) self.notify_telegram = True
def notification_email_on(self): self.__notifier = Decorator.OnEmailDecorator(self.__notifier) self.notify_email = True
def notification_inside_network_on(self): self.__notifier = Decorator.InsideNetworkDecorator(self.__notifier) self.notify_inside_network = True