-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from drewkerrigan/v2-1
Release 2.1
- Loading branch information
Showing
7 changed files
with
173 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# pylint config | ||
[MESSAGES CONTROL] | ||
disable=line-too-long, redefined-outer-name, too-many-arguments, too-many-instance-attributes, fixme, invalid-name, superfluous-parens, missing-function-docstring, missing-module-docstring, multiple-imports, no-else-return, too-many-return-statements | ||
disable=line-too-long, redefined-outer-name, too-many-arguments, too-many-instance-attributes, fixme, invalid-name, superfluous-parens, missing-function-docstring, missing-module-docstring, multiple-imports, no-else-return, too-many-return-statements, too-many-branches, too-many-statements | ||
[MASTER] | ||
ignore-patterns=^test.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.PHONY: lint test coverage | ||
|
||
lint: | ||
python3 -m pylint check_http_json.py | ||
test: | ||
python3 -m unittest discover | ||
coverage: | ||
python3 -m coverage run -m unittest discover | ||
python3 -m coverage report -m --include check_http_json.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coverage==5.0.3 | ||
pylint==2.4.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
|
||
|
||
import unittest | ||
import unittest.mock as mock | ||
import sys | ||
import os | ||
|
||
sys.path.append('..') | ||
|
||
from check_http_json import debugPrint | ||
|
||
|
||
class CLITest(unittest.TestCase): | ||
""" | ||
Tests for CLI | ||
""" | ||
|
||
def setUp(self): | ||
""" | ||
Defining the exitcodes | ||
""" | ||
|
||
self.exit_0 = 0 << 8 | ||
self.exit_1 = 1 << 8 | ||
self.exit_2 = 2 << 8 | ||
self.exit_3 = 3 << 8 | ||
|
||
def test_debugprint(self): | ||
with mock.patch('builtins.print') as mock_print: | ||
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_cli_without_params(self): | ||
|
||
command = '/usr/bin/env python3 check_http_json.py > /dev/null 2>&1' | ||
status = os.system(command) | ||
|
||
self.assertEqual(status, self.exit_2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters