def test_user_nome(): user = User("Vladimir Lenin", "*****@*****.**", "lenin#0803") assert user.name == "VLADIMIR LENIN" assert user.email == "*****@*****.**" assert user.discord_id == "lenin#0803"
def add_org(): data = request.get_json() ownerData = data['owner'] owner = User(ownerData['name'], ownerData['email'], ownerData['discord_id']) return str( organization_controller.add_organization(data['name'], data['desc'], owner, data['category']))
def test_user_email_wrong_format(): try: user = User("Vladimir Lenin", "*****@*****.**", "lenin#0803") fail() except AttributeError: pass try: user = User("Vladimir Lenin", "lenin.vladimirccc.ufcg.edu.br", "lenin#0803") fail() except AttributeError: pass try: user = User("Vladimir Lenin", "*****@*****.**", "lenin#0803") fail() except AttributeError: pass
def test_user_discord_wrong_format(): try: user = User("Vladimir Lenin", "*****@*****.**", "lenin#803") fail() except AttributeError: pass try: user = User("Vladimir Lenin", "*****@*****.**", "lenin0803") fail() except AttributeError: pass try: user = User("Vladimir Lenin", "*****@*****.**", "lenin#lenin") fail() except AttributeError: pass
def __init__(self, name, email, discord_id, period, minority_group=''): User.__init__(self, name, email, discord_id) self.period = period self.minority_group = minority_group
def test_user_name_not_string(): try: user = User(1917, "*****@*****.**", "lenin#0803") fail() except AttributeError: pass
def test_user_discord_empty(): try: user = User("Vladimir Lenin", "*****@*****.**", "") fail() except AttributeError: pass
def test_user_email_empty(): try: user = User("Vladimir Lenin", "", "lenin#0803") fail() except AttributeError: pass
def test_user_name_empty(): try: user = User("", "*****@*****.**", "lenin#0803") fail() except AttributeError: pass
def test_user_null_fields(): try: user = User(None, None, None) fail() except AttributeError: pass
def __init__(self, name, email, discord_id, state='', organization=''): User.__init__(self, name, email, discord_id) self.state = state