Skip to content

Commit

Permalink
formmatted for lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-kennedy-ecs committed Sep 29, 2023
1 parent ffcc77d commit 6231ab8
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/registrar/tests/test_models_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,13 @@ def test_domain_available(self):
Validate CheckDomain command is called
Validate response given mock
"""

def side_effect(_request, cleaned):
return MagicMock(
res_data=[
responses.check.CheckDomainResultData(name='available.gov', avail=True, reason=None)
responses.check.CheckDomainResultData(
name="available.gov", avail=True, reason=None
)
],
)

Expand All @@ -294,9 +297,7 @@ def side_effect(_request, cleaned):
[
call(
commands.CheckDomain(
[
"available.gov"
],
["available.gov"],
),
cleaned=True,
)
Expand All @@ -314,13 +315,12 @@ def test_domain_unavailable(self):
Validate CheckDomain command is called
Validate response given mock
"""

def side_effect(_request, cleaned):
return MagicMock(
res_data=[
responses.check.CheckDomainResultData(
name='unavailable.gov',
avail=False,
reason="In Use"
name="unavailable.gov", avail=False, reason="In Use"
)
],
)
Expand All @@ -334,9 +334,7 @@ def side_effect(_request, cleaned):
[
call(
commands.CheckDomain(
[
"unavailable.gov"
],
["unavailable.gov"],
),
cleaned=True,
)
Expand All @@ -358,17 +356,18 @@ def test_domain_available_with_value_error(self):
def test_domain_available_unsuccessful(self):
"""
Scenario: Testing behavior when registry raises a RegistryError
Validate RegistryError is raised
"""

def side_effect(_request, cleaned):
raise RegistryError(code=ErrorCode.COMMAND_SYNTAX_ERROR)

patcher = patch("registrar.models.domain.registry.send")
mocked_send = patcher.start()
mocked_send.side_effect = side_effect

with self.assertRaises(RegistryError) as err:
with self.assertRaises(RegistryError):
Domain.available("raises-error.gov")
patcher.stop()

Expand Down

0 comments on commit 6231ab8

Please sign in to comment.