test_request.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:pysnow 作者: rbw0 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号