def testErrorHandling(self): pseudofile = StringIO.StringIO( 'bingo bongo\n' 'ding dong\n' 'whatcha="bingo bongo"\n' 'gotcha = "bingolabongola "the wise" fingulafongula" \n') gatherer = admin_template.AdmGatherer(pseudofile) self.assertRaises(admin_template.MalformedAdminTemplateException, gatherer.Parse)
def testParsingAndTranslating(self): pseudofile = StringIO.StringIO( 'bingo bongo\n' 'ding dong\n' '[strings] \n' 'whatcha="bingo bongo"\n' 'gotcha = "bingolabongola "the wise" fingulafongula" \n') gatherer = admin_template.AdmGatherer(pseudofile) gatherer.Parse() self.failUnless(len(gatherer.GetCliques()) == 2) self.failUnless(gatherer.GetCliques()[1].GetMessage().GetRealContent() == 'bingolabongola "the wise" fingulafongula') translation = gatherer.Translate('en') self.failUnless(translation == gatherer.GetText().strip())
def testFromFile(self): fname = util.PathFromRoot('grit/testdata/GoogleDesktop.adm') gatherer = admin_template.AdmGatherer(fname) gatherer.Parse() cliques = gatherer.GetCliques() self.VerifyCliquesFromAdmFile(cliques)