def test_completion_logic(app, db_session, client): registrant = create_registrant(db_session) step = Step_0() session_manager = SessionManager(registrant, step) assert session_manager.vr_completed() == False assert session_manager.ab_completed() == False registrant.vr_completed_at = datetime.utcnow() registrant.update({'vr_form': 'foobar'}) registrant.save(db_session) session_manager = SessionManager(registrant, step) assert session_manager.vr_completed() == True assert session_manager.ab_completed() == False registrant.update({'ab_forms': 'foobar'}) registrant.save(db_session) session_manager = SessionManager(registrant, step) assert session_manager.vr_completed() == True assert session_manager.ab_completed() == False registrant.ab_completed_at = datetime.utcnow() registrant.save(db_session) session_manager = SessionManager(registrant, step) assert session_manager.vr_completed() == True assert session_manager.ab_completed() == True
def ab8_submission(): reg = g.registrant session_manager = SessionManager(reg, Step_AB_7()) if not session_manager.ab_completed(): return redirect(session_manager.get_redirect_url()) clerk = reg.try_clerk() return render_template('ab/submission.html', registrant=reg, clerk=clerk)