Пример #1
0
 def testSurvey_IntroductionNoText(self):
     surveygroup = SurveyGroup()
     surveygroup.title = "Generic sector"
     surveygroup._setOb("standard", Survey())
     survey = surveygroup["standard"]  # Acquisition wrap
     survey.title = "Standard"
     survey.introduction = "<p><br/></p>"
     survey.classification_code = None
     survey.evaluation_optional = False
     survey.language = "en-GB"
     root = self.root()
     view = ExportSurvey(None, None)
     view.exportSurvey(root, survey)
     self.assertEqual(
         safe_nativestring(etree.tostring(root, pretty_print=True)),
         '<root xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n'
         "  <survey>\n"
         "    <title>Generic sector</title>\n"
         "    <language>en-GB</language>\n"
         "    <tool_type>classic</tool_type>\n"
         "    <measures_text_handling>full</measures_text_handling>\n"
         "    <integrated_action_plan>false</integrated_action_plan>\n"
         "    <evaluation-algorithm>kinney</evaluation-algorithm>\n"
         "    <evaluation-optional>false</evaluation-optional>\n"
         "  </survey>\n"
         "</root>\n",
     )
Пример #2
0
 def testSurvey_WithProfileQuestion(self):
     surveygroup = SurveyGroup()
     surveygroup.title = "Generic sector"
     surveygroup._setOb("standard", Survey())
     survey = surveygroup["standard"]  # Acquisition wrap
     survey.title = "Generic sector"
     survey.introduction = None
     survey.classification_code = None
     survey.evaluation_optional = False
     survey.language = "en-GB"
     profile = ProfileQuestion()
     profile.title = "Office buildings"
     profile.question = "Do you have an office buildings?"
     profile.description = "<p>Owning property brings risks.</p>"
     profile.type = "optional"
     survey._setOb("1", profile)
     root = self.root()
     view = ExportSurvey(None, None)
     view.exportSurvey(root, survey)
     self.assertEqual(
         safe_nativestring(etree.tostring(root, pretty_print=True)),
         '<root xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n'
         "  <survey>\n"
         "    <title>Generic sector</title>\n"
         "    <language>en-GB</language>\n"
         "    <tool_type>classic</tool_type>\n"
         "    <measures_text_handling>full</measures_text_handling>\n"
         "    <integrated_action_plan>false</integrated_action_plan>\n"
         "    <evaluation-algorithm>kinney</evaluation-algorithm>\n"
         "    <evaluation-optional>false</evaluation-optional>\n"
         "    <profile-question>\n"
         "      <title>Office buildings</title>\n"
         "      <question>Do you have an office buildings?</question>\n"
         "      <description>&lt;p&gt;Owning property brings "
         "risks.&lt;/p&gt;</description>\n"
         "      <use-location-question>true</use-location-question>\n"
         "    </profile-question>\n"
         "  </survey>\n"
         "</root>\n",
     )