def test_send_wizard_step_segment_event(self): view = InquiryApplyWizard() step_data = { 'first': (InquiryFirstForm, FIRST_FORM_EXAMPLE_DATA), 'home': (InquiryHomeForm, HOME_FORM_EXAMPLE_DATA), } email = FIRST_FORM_EXAMPLE_DATA['email'] for step, (form_class, form_data) in step_data.items(): form = form_class(data=form_data) self.assertTrue(form.is_valid()) view._send_wizard_step_segment_event(step, form, email, 'submitted')
def test_send_wizard_step_segment_event_first( self, mocked_segment_event, mocked_get_wizard_step_event_data): view = InquiryApplyWizard() form = InquiryFirstForm(data=FIRST_FORM_EXAMPLE_DATA) self.assertTrue(form.is_valid()) data = dict(FIRST_FORM_EXAMPLE_DATA, **{'tracking_status': 'first screen submitted'}) mocked_get_wizard_step_event_data.return_value = data view._send_wizard_step_segment_event( 'first', form, form.cleaned_data['email'], 'submitted' ) # yapf: disable exported_fields = [ 'street', 'unit', 'city', 'state', 'zip_code', 'use_case_debts', 'use_case_education', 'use_case_diversify', 'use_case_buy_home', 'use_case_renovate', 'use_case_other', 'use_case_business', 'use_case_emergency', 'use_case_retirement', 'email', ] cleaned_data = form.cleaned_data mocked_get_wizard_step_event_data.assert_called_once_with( cleaned_data, exported_fields, 'first', 'submitted') mocked_segment_event.assert_called_once_with( cleaned_data['email'], 'investment inquiry - first screen submitted', data)