Skip to content

Commit

Permalink
adding one UT for log_to_stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
sv3ndk committed Dec 8, 2015
1 parent 1eb51dc commit 9410cfb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,23 @@ def test_parameterized_config_gen(self):
assert "{AIRFLOW_HOME}" not in cfg
assert "{FERNET_KEY}" not in cfg

def test_calling_log_to_stdout_should_add_one_stream_handler(self):

# first resetting the logger
root_logger = logging.getLogger()
for handler in root_logger.handlers:
root_logger.removeHandler(handler)

root_logger.setLevel(logging.NOTSET)
assert root_logger.level == logging.NOTSET

utils.log_to_stdout()
stream_handlers = [h for h in root_logger.handlers
if isinstance(h, logging.StreamHandler)]

assert len(stream_handlers) == 1
assert root_logger.level == utils.LOGGING_LEVEL

def test_calling_log_to_stdout_2X_should_add_only_one_stream_handler(self):

utils.log_to_stdout()
Expand Down

0 comments on commit 9410cfb

Please sign in to comment.