def testNoFilesToProcess(self):
     test_input = ["-t", TPL_FILE]
     main(test_input)
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("No files have been specified to be read" in output)
 def testMissingFile(self):
     test_input = ["-t", TPL_FILE, "-f", "ghost.txt"]
     # main(test_input)
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Problems reading file" in output)
 def testHelp(self):
     test_input = ['-h']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertFalse(output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
 def testUnknownArg(self):
     test_input = ['--ghost']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("unrecognized arguments" in output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
 def testFromFileCase(self):
     test_input = ["-t", TPL_FILE, "-f", COM_IN_NO_CHARGE_FILE]
     try:
         main(test_input)
         self.assertFalse(diff_lines(MISSING_MULT_COM_OUT_FILE, GOOD_COM_OUT_FILE))
     finally:
         silent_remove(MISSING_MULT_COM_OUT_FILE, disable=DISABLE_REMOVE)
         pass
 def testRouteNoChargeTpl(self):
     test_input = ["-t", ROUTE_NO_CHARGE_TPL, "-f", CP_COM_IN, "-c"]
     try:
         main(test_input)
         self.assertFalse(diff_lines(CP_COM_OUT, GOOD_ROUTE_ONLY_COM_OUT))
     finally:
         silent_remove(CP_COM_OUT, disable=DISABLE_REMOVE)
         pass
 def testFileCPTpl(self):
     test_input = ["-t", CP_COM_TPL, "-f", CP_COM_IN]
     try:
         main(test_input)
         self.assertFalse(diff_lines(CP_COM_OUT, GOOD_CP_COM_OUT))
     finally:
         silent_remove(CP_COM_OUT, disable=DISABLE_REMOVE)
         pass
 def testFromPinnedAtomFileCase(self):
     test_input = ["-t", TPL_FILE, "-f", PINNED_ATOM_IN]
     try:
         main(test_input)
         self.assertFalse(diff_lines(PINNED_ATOM_OUT, GOOD_COM_OUT_FILE))
     finally:
         silent_remove(PINNED_ATOM_OUT, disable=DISABLE_REMOVE)
         pass
 def testPinnedTpl(self):
     test_input = ["-t", PINNED_TPL_FILE, "-f", COM_IN_FILE]
     try:
         main(test_input)
         self.assertFalse(diff_lines(COM_OUT_FILE, GOOD_PINNED_OUT_FILE))
     finally:
         silent_remove(COM_OUT_FILE, disable=DISABLE_REMOVE)
         pass
 def testFromListCase(self):
     test_input = ["-t", TPL_FILE, "-l", LIST_FILE, "-c"]
     try:
         main(test_input)
         self.assertFalse(diff_lines(COM_OUT_FILE, GOOD_COM_OUT_FILE))
         self.assertFalse(diff_lines(COM_OUT_FILE2, GOOD_COM_OUT_FILE2))
     finally:
         silent_remove(COM_OUT_FILE, disable=DISABLE_REMOVE)
         silent_remove(COM_OUT_FILE2, disable=DISABLE_REMOVE)
         pass
 def testUnreadableFile(self):
     test_input = ["-t", TPL_FILE, "-f", CHK_FILE]
     main(test_input)