mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 10:46:06 +02:00
wip
This commit is contained in:
parent
99c5a06189
commit
7d9c6d1d76
2 changed files with 73 additions and 6 deletions
|
@ -595,6 +595,12 @@ class MockEppLib(TestCase):
|
||||||
return MagicMock(res_data=[self.mockDataInfoDomain])
|
return MagicMock(res_data=[self.mockDataInfoDomain])
|
||||||
elif isinstance(_request, commands.InfoContact):
|
elif isinstance(_request, commands.InfoContact):
|
||||||
return MagicMock(res_data=[self.mockDataInfoContact])
|
return MagicMock(res_data=[self.mockDataInfoContact])
|
||||||
|
elif (
|
||||||
|
isinstance(_request, commands.UpdateDomain)
|
||||||
|
and getattr(_request, "name", "fake-on-hold.gov")
|
||||||
|
and getattr(_request, "add", [common.Status(state=Domain.Status.CLIENT_HOLD, description='', lang='en')])
|
||||||
|
):
|
||||||
|
raise RegistryError(code=ErrorCode.)
|
||||||
elif (
|
elif (
|
||||||
isinstance(_request, commands.CreateContact)
|
isinstance(_request, commands.CreateContact)
|
||||||
and getattr(_request, "id", None) == "fail"
|
and getattr(_request, "id", None) == "fail"
|
||||||
|
|
|
@ -702,7 +702,7 @@ class TestRegistrantDNSSEC(TestCase):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
class TestAnalystClientHold(TestCase):
|
class TestAnalystClientHold(MockEppLib):
|
||||||
"""Rule: Analysts may suspend or restore a domain by using client hold"""
|
"""Rule: Analysts may suspend or restore a domain by using client hold"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -712,19 +712,65 @@ class TestAnalystClientHold(TestCase):
|
||||||
And a domain exists in the registry
|
And a domain exists in the registry
|
||||||
"""
|
"""
|
||||||
super().setUp()
|
super().setUp()
|
||||||
self.domain, _ = Domain.objects.get_or_create(name="security.gov")
|
# for the tests, need a domain in the ready state
|
||||||
|
self.domain, _ = Domain.objects.get_or_create(
|
||||||
|
name="fake.gov",
|
||||||
|
state=Domain.State.READY
|
||||||
|
)
|
||||||
|
# for the tests, need a domain in the on_hold state
|
||||||
|
self.domain_on_hold, _ = Domain.objects.get_or_create(
|
||||||
|
name="fake-on-hold.gov",
|
||||||
|
state=Domain.State.ON_HOLD
|
||||||
|
)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
Domain.objects.all().delete()
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
@skip("not implemented yet")
|
# def test_get_status(self):
|
||||||
|
# """Domain 'statuses' getter returns statuses by calling epp"""
|
||||||
|
# domain, _ = Domain.objects.get_or_create(name="chicken-liver.gov")
|
||||||
|
# # trigger getter
|
||||||
|
# _ = domain.statuses
|
||||||
|
# status_list = [status.state for status in self.mockDataInfoDomain.statuses]
|
||||||
|
# self.assertEquals(domain._cache["statuses"], status_list)
|
||||||
|
|
||||||
|
# # Called in _fetch_cache
|
||||||
|
# self.mockedSendFunction.assert_has_calls(
|
||||||
|
# [
|
||||||
|
# call(
|
||||||
|
# commands.InfoDomain(name="chicken-liver.gov", auth_info=None),
|
||||||
|
# cleaned=True,
|
||||||
|
# ),
|
||||||
|
# call(commands.InfoContact(id="123", auth_info=None), cleaned=True),
|
||||||
|
# call(commands.InfoHost(name="fake.host.com"), cleaned=True),
|
||||||
|
# ],
|
||||||
|
# any_order=False, # Ensure calls are in the specified order
|
||||||
|
# )
|
||||||
|
|
||||||
def test_analyst_places_client_hold(self):
|
def test_analyst_places_client_hold(self):
|
||||||
"""
|
"""
|
||||||
Scenario: Analyst takes a domain off the internet
|
Scenario: Analyst takes a domain off the internet
|
||||||
When `domain.place_client_hold()` is called
|
When `domain.place_client_hold()` is called
|
||||||
Then `CLIENT_HOLD` is added to the domain's statuses
|
Then `CLIENT_HOLD` is added to the domain's statuses
|
||||||
"""
|
"""
|
||||||
raise
|
self.domain.place_client_hold()
|
||||||
|
self.mockedSendFunction.assert_has_calls(
|
||||||
|
[
|
||||||
|
call(
|
||||||
|
commands.UpdateDomain(
|
||||||
|
name="fake.gov",
|
||||||
|
add=[common.Status(state=Domain.Status.CLIENT_HOLD, description='', lang='en')],
|
||||||
|
nsset=None,
|
||||||
|
keyset=None,
|
||||||
|
registrant=None,
|
||||||
|
auth_info=None,
|
||||||
|
),
|
||||||
|
cleaned=True,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.assertEquals(self.domain.state, Domain.State.ON_HOLD)
|
||||||
|
|
||||||
@skip("not implemented yet")
|
@skip("not implemented yet")
|
||||||
def test_analyst_places_client_hold_idempotent(self):
|
def test_analyst_places_client_hold_idempotent(self):
|
||||||
|
@ -736,7 +782,6 @@ class TestAnalystClientHold(TestCase):
|
||||||
"""
|
"""
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@skip("not implemented yet")
|
|
||||||
def test_analyst_removes_client_hold(self):
|
def test_analyst_removes_client_hold(self):
|
||||||
"""
|
"""
|
||||||
Scenario: Analyst restores a suspended domain
|
Scenario: Analyst restores a suspended domain
|
||||||
|
@ -744,7 +789,23 @@ class TestAnalystClientHold(TestCase):
|
||||||
When `domain.remove_client_hold()` is called
|
When `domain.remove_client_hold()` is called
|
||||||
Then `CLIENT_HOLD` is no longer in the domain's statuses
|
Then `CLIENT_HOLD` is no longer in the domain's statuses
|
||||||
"""
|
"""
|
||||||
raise
|
self.domain_on_hold.revert_client_hold()
|
||||||
|
self.mockedSendFunction.assert_has_calls(
|
||||||
|
[
|
||||||
|
call(
|
||||||
|
commands.UpdateDomain(
|
||||||
|
name="fake-on-hold.gov",
|
||||||
|
rem=[common.Status(state=Domain.Status.CLIENT_HOLD, description='', lang='en')],
|
||||||
|
nsset=None,
|
||||||
|
keyset=None,
|
||||||
|
registrant=None,
|
||||||
|
auth_info=None,
|
||||||
|
),
|
||||||
|
cleaned=True,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.assertEquals(self.domain_on_hold.state, Domain.State.READY)
|
||||||
|
|
||||||
@skip("not implemented yet")
|
@skip("not implemented yet")
|
||||||
def test_analyst_removes_client_hold_idempotent(self):
|
def test_analyst_removes_client_hold_idempotent(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue