当前位置: 首页>>代码示例>>Python>>正文


Python tools.create_mock_json函数代码示例

本文整理汇总了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,
    )
开发者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


注:本文中的tools.create_mock_json函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。