def test_create_call_feedback(self, request): resp = create_mock_json('tests/resources/call_feedback.json') resp.status_code = 201 request.return_value = resp mock = Mock() mock.uri = '/base' mock.auth = AUTH call = Call(mock, 'CA123') call.load_subresources() feedback = call.feedback.create( quality_score=5, issues=['imperfect-audio', 'post-dial-delay'], ) exp_data = { 'QualityScore': 5, 'Issues': ['imperfect-audio', 'post-dial-delay'], } assert_equal(5, feedback.quality_score, 5) assert_equal(['imperfect-audio', 'post-dial-delay'], feedback.issues) request.assert_called_with( "POST", "/base/CA123/Feedback", data=exp_data, auth=AUTH, timeout=ANY, use_json_extension=True, )
def test_delete(req): """ Deleting a call should work """ resp = Mock() resp.content = "" resp.status_code = 204 req.return_value = resp, {} app = Call(list_resource, "CA123") app.delete() uri = "https://api.twilio.com/2010-04-01/Accounts/AC123/Calls/CA123" req.assert_called_with("DELETE", uri)
def test_get_call_feedback(self, request): resp = create_mock_json('tests/resources/call_feedback.json') request.return_value = resp mock = Mock() mock.uri = '/base' call = Call(mock, 'CA123') call.load_subresources() feedback = call.feedback.get() assert_equal(5, feedback.quality_score, 5) assert_equal(['imperfect-audio', 'post-dial-delay'], feedback.issues)
def test_get_call_feedback(self, request): resp = create_mock_json("tests/resources/call_feedback.json") request.return_value = resp mock = Mock() mock.uri = "/base" call = Call(mock, "CA123") call.load_subresources() feedback = call.feedback.get() assert_equal(5, feedback.quality_score, 5) assert_equal(["imperfect-audio", "post-dial-delay"], feedback.issues)
def test_create_call_feedback(self, request): resp = create_mock_json("tests/resources/call_feedback.json") resp.status_code = 201 request.return_value = resp mock = Mock() mock.uri = "/base" mock.auth = AUTH call = Call(mock, "CA123") call.load_subresources() feedback = call.feedback.create(quality_score=5, issues=["imperfect-audio", "post-dial-delay"]) exp_data = {"QualityScore": 5, "Issues": ["imperfect-audio", "post-dial-delay"]} assert_equal(5, feedback.quality_score, 5) assert_equal(["imperfect-audio", "post-dial-delay"], feedback.issues) request.assert_called_with("POST", "/base/CA123/Feedback", data=exp_data, auth=AUTH, timeout=ANY)