Skip to content

Commit ca03a49

Browse files
authored
Merge pull request #2 from ByteInternet/rrpproxy_extra_commands
Add extra RRPproxy commands
2 parents 1e99ed6 + aee8104 commit ca03a49

24 files changed

Lines changed: 208 additions & 32 deletions

rrpproxy/rrpproxy.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,69 @@ def add_contact(self, **contact_data):
6464
"""Allows you to add a new contact. System automatically substitutes existing handles."""
6565
return self.call('AddContact', **contact_data)
6666

67+
def check_contact(self, contact):
68+
"""Check availability of a contact"""
69+
return self.call('CheckContact', contact=contact)
70+
6771
def check_domain(self, domain):
6872
"""Checks if the desired domain name is available and may be registered at the registry"""
6973
return self.call('CheckDomain', domain=domain)
7074

75+
def check_domain_transfer(self, domain, **transfer_data):
76+
"""Check transfer requirements of particular gTLDs"""
77+
return self.call('CheckDomainTransfer', domain=domain, **transfer_data)
78+
7179
def delete_domain(self, domain):
80+
"""The command is used to request the deletion of the domain"""
7281
return self.call('DeleteDomain', domain=domain)
7382

83+
def delete_contact(self, contact):
84+
"""Delete a contact"""
85+
return self.call('DeleteContact', contact=contact)
86+
87+
def get_zone_info(self, zone, domain):
88+
"""Query information about a zone"""
89+
return self.call('GetZoneInfo', zone=zone, domain=domain)
90+
91+
def modify_contact(self, contact, **contact_data):
92+
"""Modify a contact handle"""
93+
return self.call('ModifyContact', contact=contact, **contact_data)
94+
7495
def modify_domain(self, domain, **domain_data):
96+
"""Modify domain data"""
7597
return self.call('ModifyDomain', domain=domain, **domain_data)
7698

7799
def renew_domain(self, domain, **domain_data):
100+
"""Command used to renew domains explicitly for a specified period of time"""
78101
return self.call('RenewDomain', domain=domain, **domain_data)
79102

103+
def resend_notification(self, type, object, **extra_data):
104+
return self.call('ResendNotification', type=type, object=object, **extra_data)
105+
106+
def set_auth_code(self, domain, **extra_data):
107+
return self.call('SetAuthCode', domain=domain, **extra_data)
108+
109+
def set_domain_renewal_mode(self, domain, token, renewalmode):
110+
return self.call('SetDomainRenewalmode', domain=domain, token=token, renewalmode=renewalmode)
111+
112+
def status_contact(self, contact, auth):
113+
return self.call('StatusContact', contact=contact, auth=auth)
114+
80115
def status_domain(self, domain):
81116
"""Enables you to check the actual status of a Domain in your portfolio"""
82117
return self.call('StatusDomain', domain=domain)
118+
119+
def status_domain_transfer(self, domain):
120+
return self.call('StatusDomainTransfer', domain=domain)
121+
122+
def trade_domain(self, domain, **trade_data):
123+
"""Change registrant of a domain"""
124+
return self.call('TradeDomain', domain=domain, **trade_data)
125+
126+
def transfer_domain(self, domain, action, **transfer_data):
127+
"""This command allows you to request, approve, deny or cancel a domain transfer."""
128+
return self.call('TransferDomain', domain=domain, action=action, **transfer_data)
129+
130+
def query_zone_list(self):
131+
"""Query list of activated zones in account"""
132+
return self.call('QueryZoneList')

tests/test_rrpproxy_add_contact.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55

66
class TestRRPProxyAddContact(TestRRPProxyBase):
7-
def setup(self):
8-
super().setUp()
9-
107
@patch('rrpproxy.RRPProxy.call')
118
def test_calls_call_correctly(self, call_mock):
129
response = self.proxy.add_contact(title='Mr.', firstName='Alejandro')

tests/test_rrpproxy_add_domain.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55

66
class TestRRPProxyAddDomain(TestRRPProxyBase):
7-
def setup(self):
8-
super().setUp()
9-
107
@patch('rrpproxy.RRPProxy.call')
118
def test_calls_call_correctly(self, call_mock):
129
response = self.proxy.add_domain('example.com', 1, ownerContact0='ABC')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from unittest.mock import patch
2+
3+
from tests.test_rrpproxy_base import TestRRPProxyBase
4+
5+
6+
class TestRRPProxyCheckContact(TestRRPProxyBase):
7+
@patch('rrpproxy.RRPProxy.call')
8+
def test_calls_call_correctly(self, call_mock):
9+
response = self.proxy.check_contact('CONTACT-A')
10+
11+
call_mock.assert_called_once_with('CheckContact', contact='CONTACT-A')
12+
self.assertEqual(response, call_mock.return_value)

tests/test_rrpproxy_check_domain.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55

66
class TestRRPProxyCheckDomain(TestRRPProxyBase):
7-
def setup(self):
8-
super().setUp()
9-
107
@patch('rrpproxy.RRPProxy.call')
118
def test_calls_call_correctly(self, call_mock):
129
response = self.proxy.check_domain('example.com')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from unittest.mock import patch
2+
3+
from tests.test_rrpproxy_base import TestRRPProxyBase
4+
5+
6+
class TestRRPProxyCheckDomainTransfer(TestRRPProxyBase):
7+
@patch('rrpproxy.RRPProxy.call')
8+
def test_calls_call_correctly(self, call_mock):
9+
response = self.proxy.check_domain_transfer(domain='hypernode.com', auth='hjd7s', action='approve')
10+
11+
call_mock.assert_called_once_with('CheckDomainTransfer', domain='hypernode.com', auth='hjd7s', action='approve')
12+
self.assertEqual(response, call_mock.return_value)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from unittest.mock import patch
2+
3+
from tests.test_rrpproxy_base import TestRRPProxyBase
4+
5+
6+
class TestRRPProxyDeleteContact(TestRRPProxyBase):
7+
@patch('rrpproxy.RRPProxy.call')
8+
def test_calls_call_correctly(self, call_mock):
9+
response = self.proxy.delete_contact('CONTACT-B')
10+
11+
call_mock.assert_called_once_with('DeleteContact', contact='CONTACT-B')
12+
self.assertEqual(response, call_mock.return_value)

tests/test_rrpproxy_delete_domain.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55

66
class TestRRPProxyDeleteDomain(TestRRPProxyBase):
7-
def setup(self):
8-
super().setUp()
9-
107
@patch('rrpproxy.RRPProxy.call')
118
def test_calls_call_correctly(self, call_mock):
129
response = self.proxy.delete_domain('example.com')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from unittest.mock import patch
2+
3+
from tests.test_rrpproxy_base import TestRRPProxyBase
4+
5+
6+
class TestRRPProxyGetZoneInfo(TestRRPProxyBase):
7+
@patch('rrpproxy.RRPProxy.call')
8+
def test_calls_call_correctly(self, call_mock):
9+
response = self.proxy.get_zone_info(zone='some_zone', domain='hypernode.com')
10+
11+
call_mock.assert_called_once_with('GetZoneInfo', zone='some_zone', domain='hypernode.com')
12+
self.assertEqual(response, call_mock.return_value)

tests/test_rrpproxy_init.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44

55
class TestRRPProxyInit(TestRRPProxyBase):
6-
def setUp(self):
7-
super().setUp()
8-
96
def test_init_sets_correct_api_url_and_query_params_when_using_sandbox_environment(self):
107
self.assertEqual(self.proxy.api_url, 'https://api-ote.rrpproxy.net/api/call.cgi')
118
self.assertEqual(self.proxy.query_params, {'s_login': self.username, 's_pw': self.password, 's_opmode': 'OTE'})

0 commit comments

Comments
 (0)