Example #1
0
    def run_templater_main(self, file_prefix):
        silence = Silence()
        sys.stdout = silence

        filename = file_prefix + '.txt'

        excepted = False
        try:
            template_string = templater.graceful_read(filename)
        except SystemExit:
            excepted = True
        self.assertFalse(excepted)

        exited = False
        try:
            templater.main(filename, template_string, 10, 'test')
        except SystemExit:
            exited = True
        # self.assertTrue(exited)

        sys.stdout = sys.__stdout__

        excepted = False
        try:
            output = templater.graceful_read(file_prefix + '-test-10.txt')
        except SystemExit:
            excepted = True
        self.assertFalse(excepted)

        self.assertTrue(len(output) > 0)

        # return the result and the print log
        return (output, silence())
	def run_templater_main(self, file_prefix):
		silence = Silence()
		sys.stdout = silence
	
		filename = file_prefix + '.txt'
	
		excepted = False
		try:
			template_string = templater.graceful_read(filename)
		except SystemExit:
			excepted = True
		self.assertFalse(excepted)

		exited = False
		try:
			templater.main(filename, template_string, 10, 'test')
		except SystemExit:
			exited = True
		# self.assertTrue(exited)

		sys.stdout = sys.__stdout__

		excepted = False
		try:
			output = templater.graceful_read(file_prefix + '-test-10.txt')
		except SystemExit:
			excepted = True
		self.assertFalse(excepted)
		
		self.assertTrue(len(output) > 0)

		# return the result and the print log
		return (output, silence())
Example #3
0
    def test_file(self):
        silence = Silence()
        sys.stdout = silence

        excepted = False
        try:
            templater.graceful_read('/var/null')
        except SystemExit:
            excepted = True
        self.assertTrue(excepted)

        sys.stdout = sys.__stdout__
	def test_file(self):
		silence = Silence()
		sys.stdout = silence
		
		excepted = False
		try:
			templater.graceful_read('/var/null')
		except SystemExit:
			excepted = True
		self.assertTrue(excepted)

		sys.stdout = sys.__stdout__