tests.py 文件源码

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

项目:salesforce-stripe 作者: texastribune 项目源码 文件源码
def test_upsert_extant():

    url_re2 = re.compile(r'https://.*/services/oauth2/token')
    responses.add(
            responses.PATCH,
            'http://foo/services/data/v35.0/sobjects/Contact/0031700000BHQzBA'
            'AX',
            body='{"errors": [], "id": "a0917000002rZngAAE", "success": true}',
            status=204,
            )
    responses.add(
            responses.POST, url_re2,
            body='{"instance_url": "http://foo", "errors": [], "id": "a0917000'
            '002rZngAAE", "access_token": "bar", "success": true}',
            status=200,
            )
    responses.add(
            responses.POST,
            'http://foo/services/data/v35.0/sobjects/Contact',
            body='{"errors": [], "id": "0031700000F3kcwAAB", "success": true}',
            status=200,
            )
    responses.add_callback(
            responses.GET,
            'http://foo/services/data/v35.0/query',
            callback=request_upsert_extant_callback,
            )

    actual = upsert_customer(customer=customer, form=rdo_form)
    assert actual is True
    assert len(responses.calls) == 3
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号