-
Notifications
You must be signed in to change notification settings - Fork 766
Create dummy clients which will throw an exception when instantiated #386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
twilio/rest/__init__.py
Outdated
@@ -496,3 +497,75 @@ def __repr__(self): | |||
:rtype: str | |||
""" | |||
8000 | return '<Twilio {}>'.format(self.account_sid) | ||
|
|||
|
|||
@deprecated_client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we just made one DeprecatedClient
and then did
TwilioClient = DeprecatedClient
TwilioRestClient = DeprecatedClient
TwilioIpMessageClient = DeprecatedClient
twilio/base/obsolete.py
Outdated
raise ObsoleteException("{} has been removed from this version of the library. " | ||
"Please refer to current documentation for guidance." | ||
.format(func.__name__)) | ||
return func(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for return
here.
tests/unit/rest/test_client.py
Outdated
|
||
class TestDummyClients(unittest.TestCase): | ||
def test_deprecation_error_twilioclient(self): | ||
self.assertRaises(DeprecationWarning, TwilioClient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ObsoleteWarning
twilio/rest/__init__.py
Outdated
@obsolete_client | ||
class TwilioClient(object): | ||
""" Dummy client which provides no functionality. Please use | ||
Twilio.Rest.Client instead. """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be lowercase twilio.rest.Client
.
No description provided.