Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
36 changes: 1 addition & 35 deletions dnsimple/service/registrar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion dnsimple/struct/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 0 additions & 25 deletions dnsimple/struct/whois_privacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
16 changes: 0 additions & 16 deletions tests/fixtures/v2/api/getWhoisPrivacy/success.http

This file was deleted.

20 changes: 0 additions & 20 deletions tests/fixtures/v2/api/renewWhoisPrivacy/success.http

This file was deleted.

This file was deleted.

This file was deleted.

53 changes: 0 additions & 53 deletions tests/service/registrar_whois_privacy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()