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
评论列表
文章目录