def testProfileQuestion_Minimal(self): profile = ProfileQuestion() profile.title = "Office buildings" profile.question = "Do you have an office building?" profile.use_location_question = False root = self.root() view = ExportSurvey(None, None) node = view.exportProfileQuestion(root, profile) self.assertTrue(node in root) 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 building?</question>\n" " <use-location-question>false</use-location-question>\n" " </profile-question>\n" "</root>\n", )
def testProfileQuestion_WithoutQuestion(self): profile = ProfileQuestion() profile.title = "Office buildings" profile.description = "<p>Owning property brings risks.</p>" profile.use_location_question = False 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>Office buildings</question>\n" " <description><p>Owning property brings risks." "</p></description>\n" " <use-location-question>false</use-location-question>\n" " </profile-question>\n" "</root>\n", )