mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 12:08:40 +02:00
review changes and linting
This commit is contained in:
parent
63c2b7907f
commit
32789faec6
3 changed files with 45 additions and 33 deletions
|
@ -62,7 +62,7 @@ class RegistryError(Exception):
|
||||||
- 2501 - 2502 Something malicious or abusive may have occurred
|
- 2501 - 2502 Something malicious or abusive may have occurred
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, code=None, note="",**kwargs):
|
def __init__(self, *args, code=None, note="", **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.code = code
|
self.code = code
|
||||||
# note is a string that can be used to provide additional context
|
# note is a string that can be used to provide additional context
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
# if registry error occurs, log the error, and raise it as well
|
# if registry error occurs, log the error, and raise it as well
|
||||||
logger.error(f"registry error removing client hold: {err}")
|
logger.error(f"registry error removing client hold: {err}")
|
||||||
raise (err)
|
raise (err)
|
||||||
|
|
||||||
def _delete_domain(self):
|
def _delete_domain(self):
|
||||||
"""This domain should be deleted from the registry
|
"""This domain should be deleted from the registry
|
||||||
may raises RegistryError, should be caught or handled correctly by caller"""
|
may raises RegistryError, should be caught or handled correctly by caller"""
|
||||||
|
@ -1048,7 +1048,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
code=ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION,
|
code=ErrorCode.OBJECT_ASSOCIATION_PROHIBITS_OPERATION,
|
||||||
note=f"Host {host.name} is in use by {host.domain}",
|
note=f"Host {host.name} is in use by {host.domain}",
|
||||||
)
|
)
|
||||||
|
|
||||||
(
|
(
|
||||||
deleted_values,
|
deleted_values,
|
||||||
updated_values,
|
updated_values,
|
||||||
|
|
|
@ -2684,8 +2684,8 @@ class TestAnalystDelete(MockEppLib):
|
||||||
[
|
[
|
||||||
call(
|
call(
|
||||||
commands.UpdateDomain(
|
commands.UpdateDomain(
|
||||||
name='freeman.gov',
|
name="freeman.gov",
|
||||||
add=[common.Status(state=Domain.Status.CLIENT_HOLD, description='', lang='en')],
|
add=[common.Status(state=Domain.Status.CLIENT_HOLD, description="", lang="en")],
|
||||||
rem=[],
|
rem=[],
|
||||||
nsset=None,
|
nsset=None,
|
||||||
keyset=None,
|
keyset=None,
|
||||||
|
@ -2694,19 +2694,43 @@ class TestAnalystDelete(MockEppLib):
|
||||||
),
|
),
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.mockedSendFunction.assert_has_calls(
|
||||||
|
[
|
||||||
call(
|
call(
|
||||||
commands.InfoDomain(name='freeman.gov', auth_info=None),
|
commands.InfoDomain(name="freeman.gov", auth_info=None),
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
call(
|
call(
|
||||||
commands.InfoHost(name='fake.host.com'),
|
commands.InfoHost(name="fake.host.com"),
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
call(
|
call(
|
||||||
commands.UpdateDomain(
|
commands.UpdateDomain(
|
||||||
name='freeman.gov',
|
name="freeman.gov",
|
||||||
add=[],
|
add=[],
|
||||||
rem=[common.HostObjSet(hosts=['fake.host.com'])],
|
rem=[common.HostObjSet(hosts=["fake.host.com"])],
|
||||||
|
nsset=None,
|
||||||
|
keyset=None,
|
||||||
|
registrant=None,
|
||||||
|
auth_info=None,
|
||||||
|
),
|
||||||
|
cleaned=True,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.mockedSendFunction.assert_has_calls(
|
||||||
|
[
|
||||||
|
call(
|
||||||
|
commands.DeleteHost(name="fake.host.com"),
|
||||||
|
cleaned=True,
|
||||||
|
),
|
||||||
|
call(
|
||||||
|
commands.UpdateDomain(
|
||||||
|
name="freeman.gov",
|
||||||
|
add=[],
|
||||||
|
rem=[common.DomainContact(contact="adminContact", type="admin")],
|
||||||
nsset=None,
|
nsset=None,
|
||||||
keyset=None,
|
keyset=None,
|
||||||
registrant=None,
|
registrant=None,
|
||||||
|
@ -2715,14 +2739,14 @@ class TestAnalystDelete(MockEppLib):
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
call(
|
call(
|
||||||
commands.DeleteHost(name='fake.host.com'),
|
commands.DeleteContact(id="adminContact"),
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
call(
|
call(
|
||||||
commands.UpdateDomain(
|
commands.UpdateDomain(
|
||||||
name='freeman.gov',
|
name="freeman.gov",
|
||||||
add=[],
|
add=[],
|
||||||
rem=[common.DomainContact(contact='adminContact', type='admin')],
|
rem=[common.DomainContact(contact="techContact", type="tech")],
|
||||||
nsset=None,
|
nsset=None,
|
||||||
keyset=None,
|
keyset=None,
|
||||||
registrant=None,
|
registrant=None,
|
||||||
|
@ -2731,32 +2755,20 @@ class TestAnalystDelete(MockEppLib):
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
call(
|
call(
|
||||||
commands.DeleteContact(id='adminContact'),
|
commands.DeleteContact(id="techContact"),
|
||||||
cleaned=True,
|
|
||||||
),
|
|
||||||
call(
|
|
||||||
commands.UpdateDomain(
|
|
||||||
name='freeman.gov',
|
|
||||||
add=[],
|
|
||||||
rem=[common.DomainContact(contact='techContact', type='tech')],
|
|
||||||
nsset=None,
|
|
||||||
keyset=None,
|
|
||||||
registrant=None,
|
|
||||||
auth_info=None,
|
|
||||||
),
|
|
||||||
cleaned=True,
|
|
||||||
),
|
|
||||||
call(
|
|
||||||
commands.DeleteContact(id='techContact'),
|
|
||||||
cleaned=True,
|
|
||||||
),
|
|
||||||
call(
|
|
||||||
commands.DeleteDomain(name='freeman.gov'),
|
|
||||||
cleaned=True,
|
cleaned=True,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
any_order=True,
|
any_order=True,
|
||||||
)
|
)
|
||||||
|
self.mockedSendFunction.assert_has_calls(
|
||||||
|
[
|
||||||
|
call(
|
||||||
|
commands.DeleteDomain(name="freeman.gov"),
|
||||||
|
cleaned=True,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# Domain itself should not be deleted
|
# Domain itself should not be deleted
|
||||||
self.assertNotEqual(self.domain_with_contacts, None)
|
self.assertNotEqual(self.domain_with_contacts, None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue