コード例 #1
0
 def testSolution_Minimal(self):
     solution = Solution()
     solution.description = "<p>Test description</p>"
     solution.action = "Sample action plan"
     solution.requirements = None
     root = self.root()
     view = ExportSurvey(None, None)
     node = view.exportSolution(root, solution)
     self.assertTrue(node in root)
     self.assertEqual(
         safe_nativestring(etree.tostring(node, pretty_print=True)),
         '<solution xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n'
         "  <description>&lt;p&gt;Test description&lt;/p&gt;"
         "</description>\n"
         "  <action>Sample action plan</action>\n"
         "</solution>\n",
     )
コード例 #2
0
 def testSolution_Complete(self):
     solution = Solution()
     solution.description = "<p>Tést description</p>"
     solution.action = "Sample actiøn plan"
     solution.requirements = "Requîrements"
     root = self.root()
     view = ExportSurvey(None, None)
     node = view.exportSolution(root, solution)
     self.assertEqual(
         safe_nativestring(etree.tostring(node, pretty_print=True)),
         '<solution xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n'
         "  <description>&lt;p&gt;T&#233;st description&lt;/p&gt;"
         "</description>\n"
         "  <action>Sample acti&#248;n plan</action>\n"
         "  <requirements>Requ&#238;rements</requirements>\n"
         "</solution>\n",
     )
コード例 #3
0
 def testRisk_WithSolution(self):
     risk = Risk()
     risk.type = "top5"
     risk.title = "Can your windows be locked?"
     risk.problem_description = "Not all your windows can be locked"
     risk.description = "<p>Locking windows is critical.</p>"
     risk.legal_reference = None
     risk.show_notapplicable = False
     solution = Solution()
     solution.description = "<p>Test description</p>"
     solution.action = "Sample action plan"
     solution.requirements = None
     risk._setOb("1", solution)
     root = self.root()
     view = ExportSurvey(None, None)
     view.exportRisk(root, risk)
     self.assertEqual(
         safe_nativestring(etree.tostring(root, pretty_print=True)),
         '<root xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n'
         '  <risk type="top5">\n'
         "    <title>Can your windows be locked?</title>\n"
         "    <problem-description>Not all your windows can be locked"
         "</problem-description>\n"
         "    <description>&lt;p&gt;Locking windows is critical."
         "&lt;/p&gt;</description>\n"
         "    <show-not-applicable>false</show-not-applicable>\n"
         "    <solutions>\n"
         "      <solution>\n"
         "        <description>&lt;p&gt;Test description&lt;/p&gt;"
         "</description>\n"
         "        <action>Sample action plan</action>\n"
         "      </solution>\n"
         "    </solutions>\n"
         "  </risk>\n"
         "</root>\n",
     )