def test_error(self, mocker): log = Logger() log.set_quiet(True) log.set_verbose(False) log.error("test") sys.stderr.write.assert_called_once()
def test_info(self, mocker): log = Logger() log.set_quiet(True) self.assertTrue(log._quiet) self.assertFalse(log._verbose) log.info("test") sys.stderr.write.assert_not_called() log.set_quiet(False) self.assertFalse(log._quiet) self.assertFalse(log._verbose) log.info("test") sys.stderr.write.assert_called_once()
def test_init_logger(self): log = Logger() self.assertEquals(log._process, sys.argv[0]) self.assertFalse(log._quiet) self.assertFalse(log._verbose) init_logger("test", True, True, log) self.assertEquals(log._process, "test") self.assertTrue(log._quiet) self.assertTrue(log._verbose)
def test_set_verbose(self): log = Logger() self.assertFalse(log._quiet) self.assertFalse(log._verbose) log.set_verbose(True) self.assertFalse(log._quiet) self.assertTrue(log._verbose) log.set_verbose(False) self.assertFalse(log._quiet) self.assertFalse(log._verbose)
def test_set_process_name(self): log = Logger() self.assertEquals(log._process, sys.argv[0]) log.set_process_name(PROCESS_NAME) self.assertEquals(log._process, PROCESS_NAME)
def test_default_values(self): log = Logger() self.assertEquals(log._process, sys.argv[0]) self.assertFalse(log._quiet) self.assertFalse(log._verbose)