diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c67af4..159cb1ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/). ## main +- REMOVED: Removed deprecated `get_whois_privacy` (dnsimple/dnsimple-developer#919) +- REMOVED: Removed deprecated `renew_whois_privacy` (dnsimple/dnsimple-developer#919) + ## 6.1.0 - NEW: Added `Zones.batch_change_records` to make changes to zone records in a batch. (dnsimple/dnsimple-python#477) diff --git a/dnsimple/service/registrar.py b/dnsimple/service/registrar.py index 34f0239f..3782c18e 100644 --- a/dnsimple/service/registrar.py +++ b/dnsimple/service/registrar.py @@ -2,7 +2,7 @@ import warnings from dnsimple.response import Response -from dnsimple.struct import DomainCheck, DomainPremiumPrice, DomainRegistration, DomainTransfer, DomainRenewal, DomainRestore, RegistrantChange, VanityNameServer, WhoisPrivacy, WhoisPrivacyRenewal, DomainPrice, CheckRegistrantChangeInput, CreateRegistrantChangeInput, RegistrantChangeCheck, DomainTransferLock +from dnsimple.struct import DomainCheck, DomainPremiumPrice, DomainRegistration, DomainTransfer, DomainRenewal, DomainRestore, RegistrantChange, VanityNameServer, WhoisPrivacy, DomainPrice, CheckRegistrantChangeInput, CreateRegistrantChangeInput, RegistrantChangeCheck, DomainTransferLock class Registrar(object): @@ -341,23 +341,6 @@ def disable_domain_auto_renewal(self, account_id, domain): response = self.client.delete(f'/{account_id}/registrar/domains/{domain}/auto_renewal') return Response(response) - def get_whois_privacy(self, account_id, domain): - """ - Get the WHOIS privacy details for a domain - - See https://developer.dnsimple.com/v2/registrar/whois-privacy/#getWhoisPrivacy - - :param account_id: int - The account ID - :param domain: int/str - The domain name or id - - :return: dnsimple.Response - The whois privacy - """ - response = self.client.get(f'/{account_id}/registrar/domains/{domain}/whois_privacy') - return Response(response, WhoisPrivacy) - def enable_whois_privacy(self, account_id, domain): """ Enable WHOIS privacy @@ -401,23 +384,6 @@ def disable_whois_privacy(self, account_id, domain): response = self.client.delete(f'/{account_id}/registrar/domains/{domain}/whois_privacy') return Response(response, WhoisPrivacy) - def renew_whois_privacy(self, account_id, domain): - """ - Renew WHOIS privacy - - See https://developer.dnsimple.com/v2/registrar/whois-privacy/#renewWhoisPrivacy - - :param account_id: int - The account ID - :param domain: int/str - The domain name or id - - :return: dnsimple.Response - The whois privacy renewal - """ - response = self.client.post(f'/{account_id}/registrar/domains/{domain}/whois_privacy') - return Response(response, WhoisPrivacyRenewal) - def list_registrant_changes(self, account: int, options=None): """ List registrant changes in the account. diff --git a/dnsimple/struct/__init__.py b/dnsimple/struct/__init__.py index 17a4632b..d06ef491 100644 --- a/dnsimple/struct/__init__.py +++ b/dnsimple/struct/__init__.py @@ -28,7 +28,7 @@ from dnsimple.struct.vanity_name_server import VanityNameServer from dnsimple.struct.webhook import Webhook from dnsimple.struct.whoami import Whoami -from dnsimple.struct.whois_privacy import WhoisPrivacy, WhoisPrivacyRenewal +from dnsimple.struct.whois_privacy import WhoisPrivacy from dnsimple.struct.zone import Zone from dnsimple.struct.zone_distribution import ZoneDistribution from dnsimple.struct.zone_file import ZoneFile diff --git a/dnsimple/struct/whois_privacy.py b/dnsimple/struct/whois_privacy.py index aec9231f..730f43a3 100644 --- a/dnsimple/struct/whois_privacy.py +++ b/dnsimple/struct/whois_privacy.py @@ -22,28 +22,3 @@ class WhoisPrivacy(Struct): def __init__(self, data): super().__init__(data) - - -@dataclass -class WhoisPrivacyRenewal(Struct): - """Represents a whois privacy renewal in DNSimple""" - - id = None - """The whois privacy renewal ID in DNSimple""" - domain_id = None - """The associated domain ID""" - whois_privacy_id = None - """The associated whois privacy ID""" - state = None - """The whois Privacy order state""" - expires_on = None - """The date the whois Privacy will expire on""" - enabled = False - """Whether the whois Privacy is enabled for the domain""" - created_at = None - """When the whois Privacy was created in DNSimple""" - updated_at = None - """When the whois Privacy was last updated in DNSimple""" - - def __init__(self, data): - super().__init__(data) diff --git a/tests/fixtures/v2/api/getWhoisPrivacy/success.http b/tests/fixtures/v2/api/getWhoisPrivacy/success.http deleted file mode 100644 index b18dc401..00000000 --- a/tests/fixtures/v2/api/getWhoisPrivacy/success.http +++ /dev/null @@ -1,16 +0,0 @@ -HTTP/1.1 200 OK -Server: nginx -Date: Sat, 13 Feb 2016 14:35:37 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -Status: 200 OK -X-RateLimit-Limit: 4000 -X-RateLimit-Remaining: 3996 -X-RateLimit-Reset: 1455377135 -ETag: W/"10be37d45cd224b2178b8a2f86c466ea" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 78afe010-0f54-4d39-9ed3-08c67d545a35 -X-Runtime: 0.031770 -Strict-Transport-Security: max-age=31536000 - -{"data":{"id":1,"domain_id":2,"expires_on":"2017-02-13","enabled":true,"created_at":"2016-02-13T14:34:50Z","updated_at":"2016-02-13T14:34:52Z"}} diff --git a/tests/fixtures/v2/api/renewWhoisPrivacy/success.http b/tests/fixtures/v2/api/renewWhoisPrivacy/success.http deleted file mode 100644 index 39a77f17..00000000 --- a/tests/fixtures/v2/api/renewWhoisPrivacy/success.http +++ /dev/null @@ -1,20 +0,0 @@ -HTTP/1.1 201 Created -Server: nginx -Date: Thu, 10 Jan 2019 12:12:50 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2398 -X-RateLimit-Reset: 1547125899 -ETag: W/"e5bf5d90a6c95e5f1443dcbaf2cc27c6" -Cache-Control: max-age=0, private, must-revalidate -X-Request-Id: 6e80e830-21ae-46ea-9191-98811884808a -X-Runtime: 1.459325 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none -Strict-Transport-Security: max-age=31536000 - -{"data":{"id":1,"domain_id":100,"whois_privacy_id":999,"state":"new","expires_on":"2020-01-10","enabled":true,"created_at":"2019-01-10T12:12:48Z","updated_at":"2019-01-10T12:12:48Z"}} \ No newline at end of file diff --git a/tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-duplicated-order.http b/tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-duplicated-order.http deleted file mode 100644 index cecf31c5..00000000 --- a/tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-duplicated-order.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Thu, 10 Jan 2019 12:13:21 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2397 -X-RateLimit-Reset: 1547125899 -Cache-Control: no-cache -X-Request-Id: 16cc92bb-fe38-434b-b483-602d77ac77d3 -X-Runtime: 0.122201 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none - -{"message":"The whois privacy for example.com has just been renewed, a new renewal cannot be started at this time"} \ No newline at end of file diff --git a/tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-not-found.http b/tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-not-found.http deleted file mode 100644 index 0044413a..00000000 --- a/tests/fixtures/v2/api/renewWhoisPrivacy/whois-privacy-not-found.http +++ /dev/null @@ -1,18 +0,0 @@ -HTTP/1.1 400 Bad Request -Server: nginx -Date: Thu, 10 Jan 2019 12:11:39 GMT -Content-Type: application/json; charset=utf-8 -Connection: keep-alive -X-RateLimit-Limit: 2400 -X-RateLimit-Remaining: 2399 -X-RateLimit-Reset: 1547125899 -Cache-Control: no-cache -X-Request-Id: 2727b7c4-97af-4e22-9c7f-bd84e20f2dc1 -X-Runtime: 0.139925 -X-Frame-Options: DENY -X-Content-Type-Options: nosniff -X-XSS-Protection: 1; mode=block -X-Download-Options: noopen -X-Permitted-Cross-Domain-Policies: none - -{"message":"WHOIS privacy not found for example.com"} \ No newline at end of file diff --git a/tests/service/registrar_whois_privacy_test.py b/tests/service/registrar_whois_privacy_test.py index 13efb243..02588c70 100644 --- a/tests/service/registrar_whois_privacy_test.py +++ b/tests/service/registrar_whois_privacy_test.py @@ -2,27 +2,11 @@ import responses -from dnsimple import DNSimpleException from dnsimple.struct import WhoisPrivacy from tests.helpers import DNSimpleMockResponse, DNSimpleTest class RegistrarWhoisPrivacyTest(DNSimpleTest): - @responses.activate - def test_get_whois_privacy(self): - responses.add(DNSimpleMockResponse(method=responses.GET, - path='/1010/registrar/domains/example.com/whois_privacy', - fixture_name='getWhoisPrivacy/success')) - whois_privacy = self.registrar.get_whois_privacy(1010, 'example.com').data - - self.assertIsInstance(whois_privacy, WhoisPrivacy) - self.assertEqual(1, whois_privacy.id) - self.assertEqual(2, whois_privacy.domain_id) - self.assertEqual('2017-02-13', whois_privacy.expires_on) - self.assertTrue(whois_privacy.enabled) - self.assertEqual('2016-02-13T14:34:50Z', whois_privacy.created_at) - self.assertEqual('2016-02-13T14:34:52Z', whois_privacy.updated_at) - @responses.activate def test_enable_whois_privacy(self): responses.add(DNSimpleMockResponse(method=responses.PUT, @@ -51,43 +35,6 @@ def test_disable_whois_privacy(self): self.assertFalse(whois_privacy.enabled) - @responses.activate - def test_renew_whois_privacy(self): - responses.add(DNSimpleMockResponse(method=responses.POST, - path='/1010/registrar/domains/example.com/whois_privacy', - fixture_name='renewWhoisPrivacy/success')) - whois_privacy_renewal = self.registrar.renew_whois_privacy(1010, 'example.com').data - - self.assertEqual(1, whois_privacy_renewal.id) - self.assertEqual(100, whois_privacy_renewal.domain_id) - self.assertEqual(999, whois_privacy_renewal.whois_privacy_id) - self.assertEqual('new', whois_privacy_renewal.state) - self.assertEqual('2020-01-10', whois_privacy_renewal.expires_on) - self.assertTrue(whois_privacy_renewal.enabled) - self.assertEqual('2019-01-10T12:12:48Z', whois_privacy_renewal.created_at) - self.assertEqual('2019-01-10T12:12:48Z', whois_privacy_renewal.updated_at) - - @responses.activate - def test_renew_whois_privacy_duplicated_order(self): - responses.add(DNSimpleMockResponse(method=responses.POST, - path='/1010/registrar/domains/example.com/whois_privacy', - fixture_name='renewWhoisPrivacy/whois-privacy-duplicated-order')) - try: - self.registrar.renew_whois_privacy(1010, 'example.com') - except DNSimpleException as dnse: - self.assertEqual('The whois privacy for example.com has just been renewed, a new renewal cannot be ' - 'started at this time', dnse.message) - - @responses.activate - def test_renew_whois_privacy_not_found(self): - responses.add(DNSimpleMockResponse(method=responses.POST, - path='/1010/registrar/domains/example.com/whois_privacy', - fixture_name='renewWhoisPrivacy/whois-privacy-not-found')) - try: - self.registrar.renew_whois_privacy(1010, 'example.com') - except DNSimpleException as dnse: - self.assertEqual('WHOIS privacy not found for example.com', dnse.message) - if __name__ == '__main__': unittest.main()