increase test coverage
This commit is contained in:
parent
f818a64d3d
commit
4eab860dc0
4 changed files with 16 additions and 6 deletions
|
@ -2,6 +2,14 @@
|
||||||
debug = true
|
debug = true
|
||||||
api_key = 1234
|
api_key = 1234
|
||||||
api_url = https://api.wakatime.com/api/v1/heartbeats
|
api_url = https://api.wakatime.com/api/v1/heartbeats
|
||||||
ignore =
|
ignore =
|
||||||
COMMIT_EDITMSG$
|
COMMIT_EDITMSG$
|
||||||
TAG_EDITMSG$
|
TAG_EDITMSG$
|
||||||
|
exclude =
|
||||||
|
excludeme
|
||||||
|
\(invalid regex)
|
||||||
|
include =
|
||||||
|
\(invalid regex)
|
||||||
|
includeme
|
||||||
|
offline = true
|
||||||
|
hidefilenames = true
|
||||||
|
|
2
tests/samples/twolinefile.txt
Normal file
2
tests/samples/twolinefile.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
first line
|
||||||
|
second line
|
|
@ -29,7 +29,7 @@ class BaseTestCase(utils.TestCase):
|
||||||
response = Response()
|
response = Response()
|
||||||
response.status_code = 201
|
response.status_code = 201
|
||||||
mock_requests.return_value = response
|
mock_requests.return_value = response
|
||||||
args = ['--file', 'tests/samples/emptyfile.txt', '--key', '123', '--config', 'foo']
|
args = ['--file', 'tests/samples/twolinefile.txt', '--key', '123', '--config', 'foo']
|
||||||
retval = main(args)
|
retval = main(args)
|
||||||
self.assertEquals(retval, 0)
|
self.assertEquals(retval, 0)
|
||||||
expected_stdout = u("Error: Could not read from config file foo\n")
|
expected_stdout = u("Error: Could not read from config file foo\n")
|
||||||
|
@ -45,7 +45,7 @@ class BaseTestCase(utils.TestCase):
|
||||||
self.assertEquals(sys.stdout.getvalue(), expected_stdout)
|
self.assertEquals(sys.stdout.getvalue(), expected_stdout)
|
||||||
self.assertEquals(sys.stderr.getvalue(), expected_stderr)
|
self.assertEquals(sys.stderr.getvalue(), expected_stderr)
|
||||||
|
|
||||||
def test_parse_config_file(self, mock_requests):
|
def test_config_file(self, mock_requests):
|
||||||
response = Response()
|
response = Response()
|
||||||
response.status_code = 201
|
response.status_code = 201
|
||||||
mock_requests.return_value = response
|
mock_requests.return_value = response
|
||||||
|
@ -55,7 +55,7 @@ class BaseTestCase(utils.TestCase):
|
||||||
self.assertEquals(sys.stdout.getvalue(), '')
|
self.assertEquals(sys.stdout.getvalue(), '')
|
||||||
self.assertEquals(sys.stderr.getvalue(), '')
|
self.assertEquals(sys.stderr.getvalue(), '')
|
||||||
|
|
||||||
def test_parse_bad_config_file(self, mock_requests):
|
def test_bad_config_file(self, mock_requests):
|
||||||
args = ['--file', 'tests/samples/emptyfile.txt', '--config', 'tests/samples/bad_config.cfg']
|
args = ['--file', 'tests/samples/emptyfile.txt', '--config', 'tests/samples/bad_config.cfg']
|
||||||
retval = main(args)
|
retval = main(args)
|
||||||
self.assertEquals(retval, 103)
|
self.assertEquals(retval, 103)
|
||||||
|
|
|
@ -224,7 +224,7 @@ def should_exclude(fileName, include, exclude):
|
||||||
msg=u(ex),
|
msg=u(ex),
|
||||||
pattern=u(pattern),
|
pattern=u(pattern),
|
||||||
))
|
))
|
||||||
except TypeError:
|
except TypeError: # pragma: nocover
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
for pattern in exclude:
|
for pattern in exclude:
|
||||||
|
@ -237,7 +237,7 @@ def should_exclude(fileName, include, exclude):
|
||||||
msg=u(ex),
|
msg=u(ex),
|
||||||
pattern=u(pattern),
|
pattern=u(pattern),
|
||||||
))
|
))
|
||||||
except TypeError:
|
except TypeError: # pragma: nocover
|
||||||
pass
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue