Exemplo n.º 1
0
    def test_update(self):
        adapter = SurveyGizmoAdapter()
        with HTTMock(survey_mock, survey_question_mock,
                     survey_response_mock(self.project, self.task)):
            adapter.update_survey(self.survey)

        # There should now be 12 questions
        self.assertEqual(len(self.survey.question_set.all()), 12)
        # The project should have 2 response objects
        self.assertEqual(len(self.project.response_set.all()), 7)
        # All questions should be aggregated
        self.assertEqual(len(self.project.aggregateanswer_set.all()), 15)

        self.assertTrue(self.survey.last_synced)
Exemplo n.º 2
0
    def sync_surveys_for_client(self, client):
        """
        """
        with LocalTenant(client, clear_tenant=True):

            if properties.SURVEYGIZMO_API_TOKEN:
                self.stdout.write("Synchronizing surveys for client {0}".
                                  format(client.client_name))

                survey_adapter = SurveyGizmoAdapter()
                survey_adapter.update_surveys()
                self.stdout.write("Done synchronizing")
            else:
                self.stdout.write("No survey server configured for client {0}".
                                  format(client.client_name))
Exemplo n.º 3
0
    def synchronize(self):
        from bluebottle.surveys.adapters import SurveyGizmoAdapter

        survey_adapter = SurveyGizmoAdapter()
        survey_adapter.update_survey(self)