def testProfileQuestion_WithModule(self): profile = ProfileQuestion() profile.title = "Office buildings" profile.question = "Do you have an office buildings?" profile.description = "<p>Owning property brings risks.</p>" module = Module() module.title = "Office buildings" module.description = "<p>Owning property brings risks.</p>" module.optional = False module.solution_direction = None profile._setOb("1", module) root = self.root() view = ExportSurvey(None, None) view.exportProfileQuestion(root, profile) self.assertEqual( safe_nativestring(etree.tostring(root, pretty_print=True)), '<root xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n' " <profile-question>\n" " <title>Office buildings</title>\n" " <question>Do you have an office buildings?</question>\n" " <description><p>Owning property brings " "risks.</p></description>\n" " <use-location-question>true</use-location-question>\n" ' <module optional="false">\n' " <title>Office buildings</title>\n" " <description><p>Owning property brings " "risks.</p></description>\n" " </module>\n" " </profile-question>\n" "</root>\n", )
def testProfileQuestion_WithRisk(self): profile = ProfileQuestion() profile.title = "Office buildings" profile.question = "Do you have an office buildings?" profile.description = "<p>Owning property brings risks.</p>" 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 profile._setOb("1", risk) root = self.root() view = ExportSurvey(None, None) view.exportProfileQuestion(root, profile) self.assertEqual( safe_nativestring(etree.tostring(root, pretty_print=True)), '<root xmlns="http://xml.simplon.biz/euphorie/survey/1.0">\n' " <profile-question>\n" " <title>Office buildings</title>\n" " <question>Do you have an office buildings?</question>\n" " <description><p>Owning property brings risks." "</p></description>\n" " <use-location-question>true</use-location-question>\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" " </risk>\n" " </profile-question>\n" "</root>\n", )