def test_user_auth_fail(client, registrant): post_and_check_content(client, '/proposals/register', registrant) post_and_check_content(client, '/proposals/login', { 'usermail': '[email protected]', 'password': '******' }, values=('Login', ), follow_redirects=True)
def test_registered_user_can_login(client, registration_data): test_user_can_register(client, registration_data) post_and_check_content(client, '/proposals/login', { 'usermail': registration_data['email'], 'password': registration_data['user_pass'] }, code=302, values=('Redirecting', )) get_and_check_content(client, '/site/index.html', values=('ACCU Conference', ))
def test_username_invalid(client): post_and_check_content(client, '/proposals/register', { 'email': 'testing.test.dom', 'user_pass': '******', 'firstname': 'User2', 'lastname': 'Name2', 'phone': '+011234567890', 'pincode': '123456', 'country': 'India', 'state': 'TamilNadu', 'captcha': '1', 'question': '12', }, values=('Invalid/Duplicate user id', ))
def test_password_invalid(client): post_and_check_content(client, '/proposals/register', { 'email': '*****@*****.**', 'user_pass': '******', 'firstname': 'User2', 'lastname': 'Name2', 'phone': '+011234567890', 'pincode': '123456', 'country': 'India', 'state': 'TamilNadu', 'captcha': '1', 'question': '12' }, values=('Password did not meet checks', ))
def test_password_short(client): post_and_check_content(client, '/proposals/register', { 'email': '*****@*****.**', 'user_pass': '******', 'firstname': 'User2', 'lastname': 'Name2', 'phone': '+011234567890', 'pincode': '123456', 'country': 'India', 'state': 'TamilNadu', 'towncity': 'Chennai', 'streetaddress': 'Chepauk', 'bio': 'An indivual of the world.', 'captcha': '1', 'question': '12', }, values=('Password did not meet checks', ))
def test_logged_in_user_user_can_submit_multipresenter_multilead_proposal(client, registration_data, proposal_multiple_presenters_and_leads): test_registered_user_can_login(client, registration_data) # TODO Why do we have to send JSON here but just used dictionaries previously? rvd = post_and_check_content(client, '/proposals/upload_proposal', json.dumps(proposal_multiple_presenters_and_leads), 'application/json', values=('success',)) response = json.loads(rvd) assert response["success"] is False assert "message" in response assert "both marked as lead presenters" in response["message"] #proposal = Proposal.query.filter_by(proposer="[email protected]").first() #assert proposal is not None # TODO test stuff. user = User.query.filter_by(user_id="[email protected]").first() assert user is not None assert len(user.proposals) == 0
def test_logged_in_user_can_submit_multipresenter_single_lead_proposal(client, registration_data, proposal_multiple_presenters_single_lead): test_registered_user_can_login(client, registration_data) # TODO Why do we have to send JSON here but just used dictionaries previously? rvd = post_and_check_content(client, '/proposals/upload_proposal', json.dumps(proposal_multiple_presenters_single_lead), 'application/json', values=('success',)) response = json.loads(rvd) assert response['success'] proposal = Proposal.query.filter_by(proposer='[email protected]').first() assert proposal is not None # TODO test stuff. user = User.query.filter_by(user_id='[email protected]').first() assert user is not None assert user.proposals is not None p = user.proposals[0] assert p.proposer == user.user_id assert len(p.presenters) == 2 assert proposal.session_type == 'miniworkshop'
def test_user_reg_dup(client, registrant): test_user_reg_basic(client, registrant) post_and_check_content(client, '/proposals/register', registrant, values=('Duplicate user id', ))
def test_user_reg_basic(client, registrant): post_and_check_content(client, '/proposals/register', registrant, values=('You have successfully registered', 'Please login'))
def test_user_cannot_register_twice(client, registration_data): test_user_can_register(client, registration_data) post_and_check_content(client, '/proposals/register', registration_data, values=('Registration failed', ))
def test_user_can_register(client, registration_data): post_and_check_content(client, '/proposals/register', registration_data, values=('You have successfully registered', ))