test alternate api key config setting
This commit is contained in:
parent
f467336a8b
commit
22ddc41f25
2 changed files with 34 additions and 0 deletions
14
tests/samples/configs/sample_alternate_apikey.cfg
Normal file
14
tests/samples/configs/sample_alternate_apikey.cfg
Normal file
|
@ -0,0 +1,14 @@
|
|||
[settings]
|
||||
debug = false
|
||||
apikey = 1234
|
||||
ignore =
|
||||
COMMIT_EDITMSG$
|
||||
TAG_EDITMSG$
|
||||
exclude =
|
||||
excludeme
|
||||
\(invalid regex)
|
||||
include =
|
||||
\(invalid regex)
|
||||
includeme
|
||||
offline = true
|
||||
hidefilenames = false
|
|
@ -116,6 +116,26 @@ class BaseTestCase(utils.TestCase):
|
|||
self.patched['wakatime.offlinequeue.Queue.push'].assert_not_called()
|
||||
self.patched['wakatime.offlinequeue.Queue.pop'].assert_called_once_with()
|
||||
|
||||
def test_api_key_without_underscore_accepted(self):
|
||||
response = Response()
|
||||
response.status_code = 201
|
||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||
|
||||
entity = 'tests/samples/codefiles/emptyfile.txt'
|
||||
config = 'tests/samples/configs/sample_alternate_apikey.cfg'
|
||||
args = ['--file', entity, '--config', config]
|
||||
retval = execute(args)
|
||||
self.assertEquals(retval, 0)
|
||||
self.assertEquals(sys.stdout.getvalue(), '')
|
||||
self.assertEquals(sys.stderr.getvalue(), '')
|
||||
|
||||
self.patched['wakatime.session_cache.SessionCache.get'].assert_called_once_with()
|
||||
self.patched['wakatime.session_cache.SessionCache.delete'].assert_not_called()
|
||||
self.patched['wakatime.session_cache.SessionCache.save'].assert_called_once_with(ANY)
|
||||
|
||||
self.patched['wakatime.offlinequeue.Queue.push'].assert_not_called()
|
||||
self.patched['wakatime.offlinequeue.Queue.pop'].assert_called_once_with()
|
||||
|
||||
def test_bad_config_file(self):
|
||||
entity = 'tests/samples/codefiles/emptyfile.txt'
|
||||
config = 'tests/samples/configs/bad_config.cfg'
|
||||
|
|
Loading…
Reference in a new issue