本文整理汇总了Python中tools.create_mock_json函数的典型用法代码示例。如果您正苦于以下问题:Python create_mock_json函数的具体用法?Python create_mock_json怎么用?Python create_mock_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_mock_json函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
)
开发者ID:negeorge,项目名称:twilio-python,代码行数:30,代码来源:test_usage.py
示例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)
开发者ID:42cc,项目名称:twilio-python,代码行数:7,代码来源:test_queues.py
示例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)
开发者ID:MC6,项目名称:twilio-python,代码行数:8,代码来源:test_transcriptions.py
示例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)
开发者ID:jpf,项目名称:twilio-python,代码行数:8,代码来源:test_queues.py
示例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)
开发者ID:kevinburke,项目名称:telapi-python,代码行数:8,代码来源:test_notifications.py
示例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)
开发者ID:MC6,项目名称:twilio-python,代码行数:8,代码来源:test_calls.py
示例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)
开发者ID:jpf,项目名称:twilio-python,代码行数:8,代码来源:test_queues.py
示例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)
开发者ID:jpf,项目名称:twilio-python,代码行数:8,代码来源:test_queues.py
示例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)
开发者ID:MC6,项目名称:twilio-python,代码行数:8,代码来源:test_transcriptions.py
示例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)
开发者ID:jpf,项目名称:twilio-python,代码行数:8,代码来源:test_members.py
示例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)
开发者ID:42cc,项目名称:twilio-python,代码行数:9,代码来源:test_recordings.py
示例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)
开发者ID:B-Rich,项目名称:twilio-python,代码行数:9,代码来源:test_calls.py
示例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)
开发者ID:MC6,项目名称:twilio-python,代码行数:9,代码来源:test_calls.py
示例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)
开发者ID:kevinburke,项目名称:telapi-python,代码行数:9,代码来源:test_notifications.py
示例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
)
开发者ID:negeorge,项目名称:twilio-python,代码行数:10,代码来源:test_usage.py
示例16: test_triggers_paging
def test_triggers_paging(request):
resp = create_mock_json("tests/resources/usage_triggers_list.json")
request.return_value = resp
uri = "%s/Usage/Triggers" % BASE_URI
usage.triggers.list(recurring="daily", usage_category="sms", trigger_by="count")
request.assert_called_with(
"GET", uri, params={"Recurring": "daily", "UsageCategory": "sms", "TriggerBy": "count"}, auth=AUTH
)
开发者ID:negeorge,项目名称:twilio-python,代码行数:10,代码来源:test_usage.py
示例17: test_create_call
def test_create_call(mock):
resp = create_mock_json("tests/resources/calls_instance.json")
resp.status_code = 201
mock.return_value = resp
uri = "%s/Calls" % (BASE_URI)
list_resource.create("TO", "FROM", "url", record=True, application_sid="APPSID")
exp_params = {"To": "TO", "From": "FROM", "Url": "url", "Record": "true", "ApplicationSid": "APPSID"}
mock.assert_called_with("POST", uri, data=exp_params, auth=AUTH)
开发者ID:jpf,项目名称:twilio-python,代码行数:10,代码来源:test_calls.py
示例18: test_delete_list
def test_delete_list(mock):
resp = create_mock_json("tests/resources/recordings_instance.json")
resp.status_code = 204
mock.return_value = resp
uri = "%s/Recordings/%s" % (BASE_URI, RE_SID)
r = recordings.delete(RE_SID)
mock.assert_called_with("DELETE", uri, auth=AUTH)
assert_true(r)
开发者ID:42cc,项目名称:twilio-python,代码行数:10,代码来源:test_recordings.py
示例19: test_hangup
def test_hangup(mock):
resp = create_mock_json("tests/resources/calls_instance.json")
resp.status_code = 204
mock.return_value = resp
uri = "%s/Calls/%s" % (BASE_URI, CALL_SID)
r = list_resource.hangup(CALL_SID)
exp_data = {"Status": "completed"}
mock.assert_called_with("POST", uri, data=exp_data, auth=AUTH)
assert_true(r)
开发者ID:detcherry,项目名称:twilio-python,代码行数:11,代码来源:test_calls.py
示例20: test_get
def test_get(mock):
resp = create_mock_json("tests/resources/recordings_instance.json")
mock.return_value = resp
uri = "%s/Recordings/%s" % (BASE_URI, RE_SID)
r = recordings.get(RE_SID)
mock.assert_called_with("GET", uri, auth=AUTH)
truri = "%s/Recordings/%s/Transcriptions" % (BASE_URI, RE_SID)
assert_equals(r.transcriptions.uri, truri)
开发者ID:42cc,项目名称:twilio-python,代码行数:11,代码来源:test_recordings.py
注:本文中的tools.create_mock_json函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论