def test_get_responses_for_typeform(self): # make some other responses to see if they show up other_user = generate_fake_users(1)[0][0] other_typeform = generate_fake_typeforms(other_user, 1)[0] responses = get_responses_for_typeform(self.typeform.id) self.assertEqual(len(responses), 5) self.assertEqual(responses[0]['typeform_id'], self.typeform.id) responses = get_responses_for_typeform(other_typeform.id) self.assertEqual(len(responses), 0)
def responses(typeform_key): """get the responses of a particular typeform """ form = queries.get_typeform(user_id=current_user.id) responses = queries.get_responses_for_typeform(typeform_id=form['id']) return render_template( 'responses.html', form=form, responses=responses, )
def remote_responses(typeform_key): # make an api call to Typeform # this can be done as a background task form = queries.get_typeform( form_key=typeform_key, user_id=current_user.id, model=True) tasks.get_typeform_responses(form) responses = queries.get_responses_for_typeform(typeform_id=form.id) return render_template( "response_list.html", form=form, responses=responses)