def testSolution_Minimal(self): from euphorie.content.solution import Solution solution = Solution() solution.description = u"<p>Test description</p>" solution.action_plan = u"Sample action plan" solution.prevention_plan = None solution.requirements = None root = self.root() view = ExportSurvey(None, None) node = view.exportSolution(root, solution) self.assertTrue(node in root) self.assertEqual(etree.tostring(node, pretty_print=True), '<solution xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n' ' <description><p>Test description</p>' '</description>\n' ' <action-plan>Sample action plan</action-plan>\n' '</solution>\n')
def testSolution_Minimal(self): from euphorie.content.solution import Solution solution = Solution() solution.description = u"<p>Test description</p>" solution.action_plan = u"Sample action plan" solution.prevention_plan = None solution.requirements = None root = self.root() view = ExportSurvey(None, None) node = view.exportSolution(root, solution) self.assertTrue(node in root) self.assertEqual( etree.tostring(node, pretty_print=True), '<solution xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n' ' <description><p>Test description</p>' '</description>\n' ' <action-plan>Sample action plan</action-plan>\n' '</solution>\n')
def testSolution_Complete(self): from euphorie.content.solution import Solution solution = Solution() solution.description = u"<p>Tést description</p>" solution.action_plan = u"Sample actiøn plan" solution.prevention_plan = u"Sample prevention plån" solution.requirements = u"Requîrements" root = self.root() view = ExportSurvey(None, None) node = view.exportSolution(root, solution) self.assertEqual(etree.tostring(node, pretty_print=True), '<solution xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n' ' <description><p>Tést description</p>' '</description>\n' ' <action-plan>Sample actiøn plan</action-plan>\n' ' <prevention-plan>Sample prevention plån' '</prevention-plan>\n' ' <requirements>Requîrements</requirements>\n' '</solution>\n')
def testSolution_Complete(self): from euphorie.content.solution import Solution solution = Solution() solution.description = u"<p>Tést description</p>" solution.action_plan = u"Sample actiøn plan" solution.prevention_plan = u"Sample prevention plån" solution.requirements = u"Requîrements" root = self.root() view = ExportSurvey(None, None) node = view.exportSolution(root, solution) self.assertEqual( etree.tostring(node, pretty_print=True), '<solution xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n' ' <description><p>Tést description</p>' '</description>\n' ' <action-plan>Sample actiøn plan</action-plan>\n' ' <prevention-plan>Sample prevention plån' '</prevention-plan>\n' ' <requirements>Requîrements</requirements>\n' '</solution>\n')
def testRisk_WithSolution(self): from euphorie.content.solution import Solution from euphorie.content.risk import Risk risk = Risk() risk.type = "top5" risk.title = u"Can your windows be locked?" risk.problem_description = u"Not all your windows can be locked" risk.description = u"<p>Locking windows is critical.</p>" risk.legal_reference = None risk.show_notapplicable = False solution = Solution() solution.description = u"<p>Test description</p>" solution.action_plan = u"Sample action plan" solution.prevention_plan = None solution.requirements = None risk["1"] = solution root = self.root() view = ExportSurvey(None, None) view.exportRisk(root, risk) self.assertEqual( 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><p>Locking windows is critical.' '</p></description>\n' ' <show-not-applicable>false</show-not-applicable>\n' ' <solutions>\n' ' <solution>\n' ' <description><p>Test description</p>' '</description>\n' ' <action-plan>Sample action plan</action-plan>\n' ' </solution>\n' ' </solutions>\n' ' </risk>\n' '</root>\n')
def testRisk_WithSolution(self): from euphorie.content.solution import Solution from euphorie.content.risk import Risk risk = Risk() risk.type = "top5" risk.title = u"Can your windows be locked?" risk.problem_description = u"Not all your windows can be locked" risk.description = u"<p>Locking windows is critical.</p>" risk.legal_reference = None risk.show_notapplicable = False solution = Solution() solution.description = u"<p>Test description</p>" solution.action_plan = u"Sample action plan" solution.prevention_plan = None solution.requirements = None risk["1"] = solution root = self.root() view = ExportSurvey(None, None) view.exportRisk(root, risk) self.assertEqual(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><p>Locking windows is critical.' '</p></description>\n' ' <show-not-applicable>false</show-not-applicable>\n' ' <solutions>\n' ' <solution>\n' ' <description><p>Test description</p>' '</description>\n' ' <action-plan>Sample action plan</action-plan>\n' ' </solution>\n' ' </solutions>\n' ' </risk>\n' '</root>\n')