Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions plivo/resources/tollfree_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ def update(self,
extra_data=None,
optin_type=None,
callback_url=None,
callback_method=None):
callback_method=None,
terms_and_conditions_link=None,
privacy_policy_link=None,
optin_message=None,
help_message=None):
return self.client.tollfree_verification.update(self.uuid, profile_uuid=profile_uuid, usecase=usecase,
usecase_summary=usecase_summary, message_sample=message_sample,
optin_image_url=optin_image_url, volume=volume,
additional_information=additional_information,
extra_data=extra_data, optin_type=optin_type,
callback_url=callback_url, callback_method=callback_method)
callback_url=callback_url, callback_method=callback_method,
terms_and_conditions_link=terms_and_conditions_link,
privacy_policy_link=privacy_policy_link,
optin_message=optin_message, help_message=help_message)

class TollfreeVerifications(PlivoResourceInterface):
def __init__(self, client):
Expand All @@ -48,7 +55,11 @@ def create(self,
extra_data=None,
optin_type=None,
callback_url=None,
callback_method=None):
callback_method=None,
terms_and_conditions_link=None,
privacy_policy_link=None,
optin_message=None,
help_message=None):
return self.client.request(
'POST', ('TollfreeVerification',), to_param_dict(self.create, locals()))

Expand Down Expand Up @@ -82,7 +93,11 @@ def update(self, tollfree_verification_uuid=None,
extra_data=None,
optin_type=None,
callback_url=None,
callback_method=None):
callback_method=None,
terms_and_conditions_link=None,
privacy_policy_link=None,
optin_message=None,
help_message=None):
return self.client.request(
'POST', ('TollfreeVerification', tollfree_verification_uuid), to_param_dict(self.update, locals()))

Expand Down
26 changes: 25 additions & 1 deletion tests/resources/test_tollfree_verification.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

import json

import plivo
from tests.base import PlivoResourceTestCase
from tests.decorators import with_response
Expand Down Expand Up @@ -49,7 +51,11 @@ def test_get(self):
def test_update(self):
updated_app = self.client.tollfree_verification.update(
tollfree_verification_uuid="312b3119-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
extra_data='Testing the update of extra data in python-SDK')
extra_data='Testing the update of extra data in python-SDK',
terms_and_conditions_link="https://example.com/terms",
privacy_policy_link="https://example.com/privacy",
optin_message="Reply YES to opt in",
help_message="Reply HELP for help")

# Verifying the endpoint hit
self.assertEqual(
Expand All @@ -59,6 +65,13 @@ def test_update(self):
# Verifying the method used
self.assertEqual('POST', self.client.current_request.method)

# Verifying the new optional params are in the request body
request_body = json.loads(self.client.current_request.body)
self.assertEqual("https://example.com/terms", request_body['terms_and_conditions_link'])
self.assertEqual("https://example.com/privacy", request_body['privacy_policy_link'])
self.assertEqual("Reply YES to opt in", request_body['optin_message'])
self.assertEqual("Reply HELP for help", request_body['help_message'])

def test_delete(self):
expected_response = {}

Expand Down Expand Up @@ -91,6 +104,10 @@ def test_create(self):
optin_image_url="http://aaa.com",
additional_information="this is additional_information",
extra_data="this is extra_data",
terms_and_conditions_link="https://example.com/terms",
privacy_policy_link="https://example.com/privacy",
optin_message="Reply YES to opt in",
help_message="Reply HELP for help",
)

# Verifying the endpoint hit
Expand All @@ -100,3 +117,10 @@ def test_create(self):

# Verifying the method used
self.assertEqual('POST', self.client.current_request.method)

# Verifying the new optional params are in the request body
request_body = json.loads(self.client.current_request.body)
self.assertEqual("https://example.com/terms", request_body['terms_and_conditions_link'])
self.assertEqual("https://example.com/privacy", request_body['privacy_policy_link'])
self.assertEqual("Reply YES to opt in", request_body['optin_message'])
self.assertEqual("Reply HELP for help", request_body['help_message'])
Loading