Commit d3668365 authored by Trevor Cappallo's avatar Trevor Cappallo
Browse files

add call wrapper unit test

parent e11cbc45
......@@ -56,7 +56,8 @@ def __exit_handler(logger, notify):
class OperationalLogger:
"""Main class for Operational Logging."""
"""Main class for Operational Logging."""
DEFAULT_LOG_FORMAT_FILE = '[%(asctime)s][%(levelname)5s][p%(process)d][%(filename)s:%(lineno)d] %(message)s'
DEFAULT_LOG_FORMAT_CONSOLE = '%(asctime)s (%(levelname)5s) [%(filename)s:%(lineno)d] %(message)s'
......
#!/usr/bin/env python
"""Unit tests for OperationalLogging."""
import unittest
from nose.tools import raises, eq_
import logging
import OperationalLogger as OpLog
import subprocess
class TestCallWrappers(unittest.TestCase):
def setUp(self):
OpLog.setup(notify={'ERROR':'tcappallo@veriskclimate.com'})
def tearDown(self):
pass
def test_call_wrappers(self):
test_cmd = ["ls", "/home", "-lart"]
eq_(subprocess.call(test_cmd), OpLog.call(test_cmd))
eq_(subprocess.check_call(test_cmd), OpLog.check_call(test_cmd))
eq_(subprocess.check_output(test_cmd), OpLog.check_output(test_cmd))
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment