def testClashingConfig(self): "Test that configuration clashes are properly detected." baseF = "actionfile a\nrulefile b\nlisten 80\ndropipafter 10s\n" clashF = baseF + "expireevery -1s\n" si = StringIO.StringIO(clashF) self.assertRaises(cfloader.BadInput, cfloader.fromfile, si, "<t>") okayF = baseF + "expireevery 0s\n" # This should load OK. cfloader.fromfile(StringIO.StringIO(okayF), "<t>")
def testFromfile(self): "Test fromfile to see that it accepts known good input (also tests multiple listen directives)." cffile = "actionfile a\nrulefile b\nlisten 80@\nlisten [email protected]\n" si = StringIO.StringIO(cffile) cf = cfloader.fromfile(si, "<t>") self.assertEqual(str(cf), cffile)