mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2026-02-05 22:55:15 +01:00
Add verbose flag and function that can be used to enhance output more precisely
- Before we only had a boolean debug flag, good for debugging errors. The verbose flag can be used more precisely (`-v -vvv`) to specify when something should be printed. This is useful for adding more output whilst avoiding full debug output that contains secrets.
This commit is contained in:
@@ -9,6 +9,7 @@ import os
|
||||
sys.path.append('..')
|
||||
|
||||
from check_http_json import debugPrint
|
||||
from check_http_json import verbosePrint
|
||||
|
||||
|
||||
class CLITest(unittest.TestCase):
|
||||
@@ -31,10 +32,13 @@ class CLITest(unittest.TestCase):
|
||||
debugPrint(True, 'debug')
|
||||
mock_print.assert_called_once_with('debug')
|
||||
|
||||
def test_debugprint_pprint(self):
|
||||
with mock.patch('check_http_json.pprint') as mock_pprint:
|
||||
debugPrint(True, 'debug', True)
|
||||
mock_pprint.assert_called_once_with('debug')
|
||||
def test_verbose(self):
|
||||
with mock.patch('builtins.print') as mock_print:
|
||||
verbosePrint(0, 3, 'verbose')
|
||||
mock_print.assert_not_called()
|
||||
|
||||
verbosePrint(3, 3, 'verbose')
|
||||
mock_print.assert_called_once_with('verbose')
|
||||
|
||||
def test_cli_without_params(self):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user