本文整理汇总了Python中tools.create_mock_json函数的典型用法代码示例。如果您正苦于以下问题:Python create_mock_json函数的具体用法?Python create_mock_json怎么用?Python create_mock_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_mock_json函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_triggers_create
def test_triggers_create(request):
resp = create_mock_json("tests/resources/usage_triggers_instance.json")
resp.status_code = 201
request.return_value = resp
usage.triggers.create(
friendly_name="foo",
usage_category="sms",
trigger_by="count",
recurring="price",
trigger_value="10.00",
callback_url="http://www.example.com",
callback_method="POST",
)
uri = "%s/Usage/Triggers" % BASE_URI
request.assert_called_with(
"POST",
uri,
data={
"FriendlyName": "foo",
"UsageCategory": "sms",
"TriggerBy": "count",
"Recurring": "price",
"TriggerValue": "10.00",
"CallbackUrl": "http://www.example.com",
"CallbackMethod": "POST",
},
auth=AUTH,
)
示例2: test_queues_get
def test_queues_get(mock):
resp = create_mock_json("tests/resources/queues_instance.json")
mock.return_value = resp
uri = "%s/Queues/%s" % (BASE_URI, QUEUE_SID)
list_resource.get(QUEUE_SID)
mock.assert_called_with("GET", uri, auth=AUTH)
示例3: test_paging
def test_paging(mock):
resp = create_mock_json("tests/resources/transcriptions_list.json")
mock.return_value = resp
uri = "{}/Transcriptions".format(BASE_URI)
transcriptions.list(page=2)
mock.assert_called_with("GET", uri, params={"Page": 2}, auth=AUTH)
示例4: test_queue_delete
def test_queue_delete(mock):
resp = create_mock_json("tests/resources/queues_instance.json")
mock.return_value = resp
uri = "%s/Queues/%s" % (BASE_URI, QUEUE_SID)
r = instance_resource.delete()
mock.assert_called_with("DELETE", uri, auth=AUTH)
示例5: test_get
def test_get(mock):
resp = create_mock_json("tests/resources/notifications_instance.json")
mock.return_value = resp
uri = "{}/Notifications/{}".format(BASE_URI, RE_SID)
r = list_reosource.get(RE_SID)
mock.assert_called_with("GET", uri, auth=AUTH)
示例6: test_get
def test_get(mock):
resp = create_mock_json("tests/resources/calls_instance.json")
mock.return_value = resp
uri = "{}/Calls/{}".format(BASE_URI, CALL_SID)
r = list_resource.get(CALL_SID)
mock.assert_called_with("GET", uri, auth=AUTH)
示例7: test_queues_list
def test_queues_list(mock):
resp = create_mock_json("tests/resources/queues_list.json")
mock.return_value = resp
uri = "%s/Queues" % (BASE_URI)
list_resource.list()
mock.assert_called_with("GET", uri, params={}, auth=AUTH)
示例8: test_queue_update
def test_queue_update(mock):
resp = create_mock_json("tests/resources/queues_instance.json")
mock.return_value = resp
uri = "%s/Queues/%s" % (BASE_URI, QUEUE_SID)
r = instance_resource.update(friendly_name='QQ')
mock.assert_called_with("POST", uri, data={'FriendlyName':'QQ'}, auth=AUTH)
示例9: test_get
def test_get(mock):
resp = create_mock_json("tests/resources/transcriptions_instance.json")
mock.return_value = resp
uri = "{}/Transcriptions/TR123".format(BASE_URI)
transcriptions.get("TR123")
mock.assert_called_with("GET", uri, auth=AUTH)
示例10: test_members_dequeue_call
def test_members_dequeue_call(mock):
resp = create_mock_json("tests/resources/members_instance.json")
mock.return_value = resp
uri = "%s/Members/%s" % (BASE_URI, CALL_SID)
list_resource.dequeue(TWIML_URL, call_sid=CALL_SID)
mock.assert_called_with("POST", uri, data={"Url": TWIML_URL}, auth=AUTH)
示例11: test_paging
def test_paging(mock):
resp = create_mock_json("tests/resources/recordings_list.json")
mock.return_value = resp
uri = "%s/Recordings" % (BASE_URI)
recordings.list(call_sid="CA123", before=date(2010, 12, 5))
exp_params = {'CallSid': 'CA123', 'DateCreated<': '2010-12-05'}
mock.assert_called_with("GET", uri, params=exp_params, auth=AUTH)
示例12: test_paging
def test_paging(mock):
resp = create_mock_json("tests/resources/calls_list.json")
mock.return_value = resp
uri = "%s/Calls" % (BASE_URI)
list_resource.list(started=date(2010, 12, 5))
exp_params = {"StartTime": "2010-12-05"}
mock.assert_called_with("GET", uri, params=exp_params, auth=AUTH)
示例13: test_paging
def test_paging(mock):
resp = create_mock_json("tests/resources/calls_list.json")
mock.return_value = resp
uri = "{}/Calls".format(BASE_URI)
list_resource.list(started_before=date(2010,12,5))
exp_params = {'StartTime<': '2010-12-05'}
mock.assert_called_with("GET", uri, params=exp_params, auth=AUTH)
示例14: test_paging
def test_paging(mock):
resp = create_mock_json("tests/resources/notifications_list.json")
mock.return_value = resp
uri = "{}/Notifications".format(BASE_URI)
list_resource.list(before=date(2010, 12, 5))
exp_params = {"MessageDate<": "2010-12-05"}
mock.assert_called_with("GET", uri, params=exp_params, auth=AUTH)
示例15: test_records_paging
def test_records_paging(request):
resp = create_mock_json("tests/resources/usage_records_list.json")
request.return_value = resp
uri = "%s/Usage/Records" % BASE_URI
usage.records.list(start_date="2012-10-12", end_date="2012-10-13", category="sms")
request.assert_called_with(
"GET", uri, params={"StartDate": "2012-10-12", "EndDate": "2012-10-13", "Category": "sms"}, auth=AUTH
)