def test_delete_instance(self, request):
        resp = Mock()
        resp.content = ""
        resp.status_code = 204
        request.return_value = resp

        uri = "{0}/Tasks/{1}".format(BASE_URI, TASK_SID)
        list_resource = Tasks(BASE_URI, AUTH)
        task = Task(list_resource, TASK_SID)
        task.delete()
        request.assert_called_with("DELETE", uri, auth=AUTH,
                                   use_json_extension=False)
示例#2
0
    def test_delete_instance(self, request):
        resp = Mock()
        resp.content = ""
        resp.status_code = 204
        request.return_value = resp

        uri = "{0}/Tasks/{1}".format(BASE_URI, TASK_SID)
        list_resource = Tasks(BASE_URI, AUTH)
        task = Task(list_resource, TASK_SID)
        task.delete()
        request.assert_called_with("DELETE",
                                   uri,
                                   auth=AUTH,
                                   use_json_extension=False)
    def test_update_instance(self, request):
        resp = create_mock_json('tests/resources/task_router/tasks_instance.json')
        resp.status_code = 201
        request.return_value = resp

        uri = "{0}/Tasks/{1}".format(BASE_URI, TASK_SID)
        list_resource = Tasks(BASE_URI, AUTH)
        workflow = Task(list_resource, TASK_SID)
        workflow.update(attributes='attributes', workflow_sid='WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
        exp_params = {
            'Attributes': "attributes",
            'WorkflowSid': "WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        }

        request.assert_called_with("POST", uri, data=exp_params, auth=AUTH,
                                   use_json_extension=False)
示例#4
0
    def test_update_instance(self, request):
        resp = create_mock_json(
            'tests/resources/task_router/tasks_instance.json')
        resp.status_code = 201
        request.return_value = resp

        uri = "{0}/Tasks/{1}".format(BASE_URI, TASK_SID)
        list_resource = Tasks(BASE_URI, AUTH)
        workflow = Task(list_resource, TASK_SID)
        workflow.update(attributes='attributes',
                        workflow_sid='WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
        exp_params = {
            'Attributes': "attributes",
            'WorkflowSid': "WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
        }

        request.assert_called_with("POST",
                                   uri,
                                   data=exp_params,
                                   auth=AUTH,
                                   use_json_extension=False)