def test_request_reset_post_302(url, client): with mail.record_messages() as outbox: data = {'email': '*****@*****.**'} resp = client.post(url, data=data) assert len(outbox) == 1 assert urllib2.quote(valid_user().create_token()) in outbox[0].body assert resp.status_code == 302
def test_valid_token_not_valid_data(): url = url_for('account.confirm_reset', token=valid_user().create_token()) with app.test_client() as c: resp = c.post(url, data={'password': '******', 'password_confirm': ''}) assert resp.status_code == 200 assert "Passwords don't match" in resp.data resp = c.post(url, data={'password': '', 'password_confirm': '111'}) assert resp.status_code == 200 assert "Passwords don't match" in resp.data resp = c.post(url, data={'password': '******', 'password_confirm': '222'}) assert resp.status_code == 200 assert "Passwords don't match" in resp.data resp = c.post(url, data={'password': '******', 'password_confirm': '111'}) assert resp.status_code == 302
def test_valid_token(): url = url_for('account.confirm_reset', token=valid_user().create_token()) with app.test_client() as c: resp = c.get(url) assert resp.status_code == 200