Example #1
0
	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>")
Example #2
0
	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)