def test_subscribed_period_without_semester(): try: sub = Subscribed('Bakugo', '*****@*****.**', 'Boom#4576', '2015') fail('Periodo sem semestre foi cadastrado') except AttributeError: pass
def test_subscribed_letters_period(): try: sub = Subscribed('Lida', '*****@*****.**', 'Runner#4576', 'doismilequize.1') fail('Periodo vazio foi cadastrado') except AttributeError: pass
def test_subscribed_empty_period(): try: sub = Subscribed('Uraraka', '*****@*****.**', 'Uravity#4576', '') fail('Periodo vazio foi cadastrado') except AttributeError: pass
def test_subscribed_create_sucess(): sub = Subscribed('Midorya', '*****@*****.**', 'Deku#1969', '2016.2', 'LGBTQA+') assert sub.name == 'MIDORYA' assert sub.email == '*****@*****.**' assert sub.discord_id == 'Deku#1969' assert sub.period == '2016.2' assert sub.minority_group == 'LGBTQA+'
def test_sbuscribed_empty_minority_group(): sub = Subscribed('Todoroki', '*****@*****.**', 'Shoto#8445', '2015.1', '') assert sub.minority_group == ''
def test_subscribed_null_fields(): try: sub = Subscribed(None, None, None, None) fail('Campos Null foram cadastrados') except AttributeError: pass
def add_subscriber(self, name, email, discord, period, minoritary_group): self.validating_existing_email(email) subscribed = Subscribed(name, email, discord, period, minoritary_group) self.subscribers[email] = subscribed return self.subscribers[email]