def test_onboarding_step_1_works(graphql_client): ob = _exec_onboarding_step_n(1, graphql_client) assert ob['errors'] == [] assert ob['session']['onboardingStep1'] == VALID_STEP_DATA[1] assert graphql_client.request.session[session_key_for_step( 1)]['apt_number'] == '3B' assert _get_step_1_info(graphql_client)['aptNumber'] == '3B' assert _get_step_1_info(graphql_client)['addressVerified'] is False
def test_onboarding_session_info_is_fault_tolerant(graphql_client): key = session_key_for_step(1) graphql_client.request.session[key] = {'lol': 1} with patch('onboarding.schema.logger') as m: assert _get_step_1_info(graphql_client) is None m.exception.assert_called_once_with(f'Error deserializing {key} from session') assert key not in graphql_client.request.session
def test_onboarding_step_1_validates_data(graphql_client): ob = _exec_onboarding_step_n(1, graphql_client, firstName='') assert len(ob['errors']) > 0 assert session_key_for_step(1) not in graphql_client.request.session assert _get_step_1_info(graphql_client) is None