def test_registration_bad_frist_name(): params = {"username":"******", "password":"******", "first_name":NEW_USER_FNAME, "last_name":'2'+NEW_USER_LNAME, "email":"*****@*****.**", "team":"team-ABC", "college":"college-1"} r,data = test_helpers.server_post("/registrations", params) assert r.status == 403 assert 'BAD_LAST_NAME' in data assert len(test_helpers.get_registrations()) == 0 try: created = User.create_user('1_rt1') assert False, "Should not have created user" except: pass pending = PendingUser('1_rt1') assert not pending.in_db test_helpers.assert_no_emails()
def test_registration_rq_from_student(): test_helpers.delete_db() params = {"username":"******", "password":"******", "first_name":"register", "last_name":"this.user", "email":"*****@*****.**", "team":"team-ABC", "college":"college-1"} r,data = test_helpers.server_post("/registrations", params) status = r.status assert status == 403 assert 'YOU_CANT_REGISTER_USERS' in data assert len(test_helpers.get_registrations()) == 0 try: created = User.create_user('2_rt1') assert False, "Should not have created user" except: pass pending = PendingUser('2_rt1') assert not pending.in_db test_helpers.assert_no_emails()
def test_registration_email_in_use(): params = {"username":"******", "password":"******", "first_name":NEW_USER_FNAME, "last_name":NEW_USER_LNAME, "email":"*****@*****.**", # student_coll2_2 "team":"team-ABC", "college":"college-1"} r,data = test_helpers.server_post("/registrations", params) assert r.status == 403 assert 'DETAILS_ALREADY_USED' in data assert len(test_helpers.get_registrations()) == 0 try: created = User.create_user('1_rt1') assert False, "Should not have created user" except: pass pending = PendingUser('1_rt1') assert not pending.in_db test_helpers.assert_no_emails()
def test_registration_email_in_use(): params = { "username": "******", "password": "******", "first_name": NEW_USER_FNAME, "last_name": NEW_USER_LNAME, "email": "*****@*****.**", # student_coll2_2 "team": "team-ABC", "college": "college-1", } r, data = test_helpers.server_post("/registrations", params) assert r.status == 403 assert "DETAILS_ALREADY_USED" in data assert len(test_helpers.get_registrations()) == 0 try: created = User.create_user("1_rt1") assert False, "Should not have created user" except: pass pending = PendingUser("1_rt1") assert not pending.in_db test_helpers.assert_no_emails()
def test_registration_rq_from_student(): test_helpers.delete_db() params = { "username": "******", "password": "******", "first_name": "register", "last_name": "this.user", "email": "*****@*****.**", "team": "team-ABC", "college": "college-1", } r, data = test_helpers.server_post("/registrations", params) status = r.status assert status == 403 assert "YOU_CANT_REGISTER_USERS" in data assert len(test_helpers.get_registrations()) == 0 try: created = User.create_user("2_rt1") assert False, "Should not have created user" except: pass pending = PendingUser("2_rt1") assert not pending.in_db test_helpers.assert_no_emails()
def test_registration_name_in_use(): params = {"username":"******", "password":"******", "first_name":'student2', # student_coll1_2 "last_name":'student', "email":"*****@*****.**", "team":"team-ABC", "college":"college-1"} r,data = test_helpers.server_post("/registrations", params) status = r.status assert status == 403, data assert 'DETAILS_ALREADY_USED' in data assert len(test_helpers.get_registrations()) == 0 try: created = User.create_user('1_ss1') assert False, "Should not have created user" except: pass pending = PendingUser('1_ss1') assert not pending.in_db test_helpers.assert_no_emails()
def test_registration_wrong_college(): params = {"username":"******", "password":"******", "first_name":NEW_USER_FNAME, "last_name":NEW_USER_LNAME, "email":"*****@*****.**", "team":"team-ABC", "college":"college-2"} r,data = test_helpers.server_post("/registrations", params) status = r.status assert status == 403 assert 'BAD_COLLEGE' in data assert len(test_helpers.get_registrations()) == 0 test_helpers.delete_db()
def test_registration_not_authed(): test_helpers.delete_db() params = {"username":"******", "first_name":"register", "last_name":"this.user", "email":"*****@*****.**", "team":"team-ABC", "college":"college-1"} r,data = test_helpers.server_post("/registrations", params) status = r.status assert status == 403 assert 'NO_PASSWORD' in data assert len(test_helpers.get_registrations()) == 0 test_helpers.delete_db()