mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
b82eec714a
Summary: this moves sandbox/grist to core, and adds a requirements.txt file for reconstructing the content of sandbox/thirdparty. Test Plan: existing tests pass. Tested core functionality manually. Tested docker build manually. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2563
39 lines
916 B
Python
39 lines
916 B
Python
import unittest
|
|
import logger
|
|
|
|
|
|
class TestLogger(unittest.TestCase):
|
|
def _log_handler(self, level, name, msg):
|
|
self.messages.append((level, name, msg))
|
|
|
|
def setUp(self):
|
|
self.messages = []
|
|
self.orig_handler = logger.set_handler(self._log_handler)
|
|
|
|
def tearDown(self):
|
|
logger.set_handler(self.orig_handler)
|
|
|
|
def test_logger(self):
|
|
log = logger.Logger("foo", logger.INFO)
|
|
log.info("Hello Info")
|
|
log.debug("Hello Debug")
|
|
log.warn("Hello Warn")
|
|
|
|
self.assertEqual(self.messages, [
|
|
(logger.INFO, 'foo', 'Hello Info'),
|
|
(logger.WARN, 'foo', 'Hello Warn'),
|
|
])
|
|
del self.messages[:]
|
|
|
|
log = logger.Logger("baz", logger.DEBUG)
|
|
log.debug("Hello Debug")
|
|
log.info("Hello Info")
|
|
self.assertEqual(self.messages, [
|
|
(logger.DEBUG, 'baz', 'Hello Debug'),
|
|
(logger.INFO, 'baz', 'Hello Info'),
|
|
])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|