def test_get_multiple_with_offset(self):
"""
Make sure offset works properly
"""
json_body = json.dumps({'result': [{'sys_id': self.mock_incident['sys_id'], 'this': 'that'},
{'sys_id': self.mock_incident['sys_id'], 'this': 'that'}]})
httpretty.register_uri(httpretty.GET,
"http://%s/%s" % (self.mock_connection['host'], self.mock_incident['path']),
body=json_body,
status=200,
content_type="application/json")
r = self.client.query(table='incident', query={'number': self.mock_incident['number']})
list(r.get_multiple(limit=100, offset=50))
qs = httpretty.last_request().querystring
# Make sure sysparm_offset is set to the expected value
self.assertEqual(int(qs['sysparm_offset'][0]), 50)
# Make sure sysparm_limit is set to the expected value
self.assertEqual(int(qs['sysparm_limit'][0]), 100)
评论列表
文章目录