Expect bulk results under responses key
This commit is contained in:
parent
5554f3c9dd
commit
4c7b49a28c
4 changed files with 18 additions and 18 deletions
|
@ -527,7 +527,7 @@ class ArgumentsTestCase(TestCase):
|
||||||
logging.disable(logging.NOTSET)
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null, 201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now1 = u(int(time.time()))
|
now1 = u(int(time.time()))
|
||||||
|
@ -590,7 +590,7 @@ class ArgumentsTestCase(TestCase):
|
||||||
logging.disable(logging.NOTSET)
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null, 201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now1 = u(int(time.time()))
|
now1 = u(int(time.time()))
|
||||||
|
@ -653,7 +653,7 @@ class ArgumentsTestCase(TestCase):
|
||||||
logging.disable(logging.NOTSET)
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null, 201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
with TemporaryDirectory() as tempdir:
|
with TemporaryDirectory() as tempdir:
|
||||||
|
@ -717,7 +717,7 @@ class ArgumentsTestCase(TestCase):
|
||||||
logging.disable(logging.NOTSET)
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null, 201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
with TemporaryDirectory() as tempdir:
|
with TemporaryDirectory() as tempdir:
|
||||||
|
@ -814,7 +814,7 @@ class ArgumentsTestCase(TestCase):
|
||||||
logging.disable(logging.NOTSET)
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null, 201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now1 = u(int(time.time()))
|
now1 = u(int(time.time()))
|
||||||
|
@ -880,7 +880,7 @@ class ArgumentsTestCase(TestCase):
|
||||||
logging.disable(logging.NOTSET)
|
logging.disable(logging.NOTSET)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null, 201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now1 = u(int(time.time()))
|
now1 = u(int(time.time()))
|
||||||
|
|
|
@ -84,7 +84,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
execute(args)
|
execute(args)
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null,201], [null,201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
execute(args)
|
execute(args)
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
args = ['--file', entity3, '--config', config, '--time', now3, '--project', project3]
|
args = ['--file', entity3, '--config', config, '--time', now3, '--project', project3]
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null,201], [null,201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
execute(args)
|
execute(args)
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_code = 202
|
response.response_code = 202
|
||||||
response.response_text = '[[{"id":1},201], [{"error":"error 2"},500], [{"id":3},201], [{"error":4},500]]'
|
response.response_text = '{"responses": [[null,201], [null,500], [null,201], [null, 500]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
with mock.patch('wakatime.main.sys.stdin') as mock_stdin:
|
with mock.patch('wakatime.main.sys.stdin') as mock_stdin:
|
||||||
|
@ -273,7 +273,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_code = 202
|
response.response_code = 202
|
||||||
response.response_text = '[[{"id":1},201], [{"error":"error 2"},500], [{"id":3},201], [{"error":4},500]]'
|
response.response_text = '{"responses": [[null,201], [null,500], [null,201], [null, 500]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
with mock.patch('wakatime.main.sys.stdin') as mock_stdin:
|
with mock.patch('wakatime.main.sys.stdin') as mock_stdin:
|
||||||
|
@ -328,7 +328,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_code = 202
|
response.response_code = 202
|
||||||
response.response_text = '[[{"id":1},201], [{"id":3},201]]'
|
response.response_text = '{"responses": [[null,201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
with mock.patch('wakatime.main.sys.stdin') as mock_stdin:
|
with mock.patch('wakatime.main.sys.stdin') as mock_stdin:
|
||||||
|
@ -390,7 +390,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.second_response_code = 401
|
response.second_response_code = 401
|
||||||
response.limit = 2
|
response.limit = 2
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null,201], [null,201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
retval = execute(args)
|
retval = execute(args)
|
||||||
|
@ -436,7 +436,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.second_response_code = 500
|
response.second_response_code = 500
|
||||||
response.limit = 2
|
response.limit = 2
|
||||||
response.response_text = '[[{"id":1},201], [{"id":1},201], [{"id":1},201]]'
|
response.response_text = '{"responses": [[null,201], [null,201], [null,201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
retval = execute(args)
|
retval = execute(args)
|
||||||
|
@ -751,7 +751,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
mock_db_file.return_value = fh.name
|
mock_db_file.return_value = fh.name
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{id":1}]]'
|
response.response_text = '{"responses": [[{id":1},201]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now = u(int(time.time()))
|
now = u(int(time.time()))
|
||||||
|
@ -779,7 +779,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
mock_db_file.return_value = fh.name
|
mock_db_file.return_value = fh.name
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[0]'
|
response.response_text = '{"responses": [1]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now = u(int(time.time()))
|
now = u(int(time.time()))
|
||||||
|
@ -807,7 +807,7 @@ class OfflineQueueTestCase(TestCase):
|
||||||
mock_db_file.return_value = fh.name
|
mock_db_file.return_value = fh.name
|
||||||
|
|
||||||
response = CustomResponse()
|
response = CustomResponse()
|
||||||
response.response_text = '[[{"id":1}]]'
|
response.response_text = '{"responses": [[{"id":1}]]}'
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
now = u(int(time.time()))
|
now = u(int(time.time()))
|
||||||
|
|
|
@ -233,7 +233,7 @@ class DynamicIterable(object):
|
||||||
|
|
||||||
class CustomResponse(Response):
|
class CustomResponse(Response):
|
||||||
response_code = 201
|
response_code = 201
|
||||||
response_text = '[[{"id":1},201]]'
|
response_text = '{"responses": [[null,201]]}'
|
||||||
limit = 0
|
limit = 0
|
||||||
second_response_code = 0
|
second_response_code = 0
|
||||||
second_response_text = None
|
second_response_text = None
|
||||||
|
|
|
@ -210,7 +210,7 @@ def _get_results(response):
|
||||||
results = []
|
results = []
|
||||||
if response is not None:
|
if response is not None:
|
||||||
try:
|
try:
|
||||||
results = response.json()
|
results = response.json()['responses']
|
||||||
except:
|
except:
|
||||||
log.traceback(logging.WARNING)
|
log.traceback(logging.WARNING)
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in a new issue