Exemple #1
0
 def testDisplay(self):
     survey = connection.execute(survey_table.select().where(
         survey_table.c.survey_title == 'test_title')).first()
     self.assertEqual(survey.survey_title,
                      display(connection,
                              survey.survey_id).survey_title)
     self.assertRaises(SurveyDoesNotExistError, display, connection,
                       str(uuid.uuid4()))
Exemple #2
0
def display_survey(connection: Connection, survey_id: str) -> dict:
    """
    Get a JSON representation of a survey. Use this to display a survey for
    submission purposes.

    :param connection: a SQLAlchemy Connection
    :param survey_id: the UUID of the survey
    :return: the JSON representation.
    """
    return json_response(_to_json(connection, display(connection, survey_id)))