Skip to content

Commit

Permalink
Fix irr_rpsl_submit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha Romijn committed Sep 27, 2024
1 parent 87dbd44 commit 6bddcec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
17 changes: 0 additions & 17 deletions irrd/scripts/irr_rpsl_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,6 @@ def prefix(self):
return "Connection refused" # pragma: no cover


class XHTTPNotFound(XNetwork):
"""
Raised when the response returns 404.
This is a refinement of HTTPError, which is not granular enough
to provide useful information to consumers.
"""

def prefix(self):
"""
Returns the prefix to attach to the start of each logged message.
"""
return "Not found"


class XNameResolutionFailed(XNetwork):
"""
Raised when urllib cannot resolve the URL host.
Expand Down Expand Up @@ -763,8 +748,6 @@ def send_request(requests_text, args):
raise XNameResolutionFailed(args.url, reason) from error
if isinstance(reason, (socket.timeout, ConnectionRefusedError)):
raise XHTTPConnectionFailed(args.url, http_request) from error # pragma: no cover
if reason == "Not Found":
raise XHTTPNotFound(args.url, http_request) from error
raise error # pragma: no cover: CI glitch workaround
except Exception as error:
raise error
Expand Down
8 changes: 4 additions & 4 deletions irrd/scripts/tests/test_irr_rpsl_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
REGEX_UNRESOLVABLE = re.compile("Could not resolve")
REGEX_UNREACHABLE = re.compile("Connection refused|Cannot assign requested address")
REGEX_BAD_RESPONSE = re.compile("decoding JSON")
REGEX_NOT_FOUND = re.compile("Not found")
REGEX_NOT_ALLOWED = re.compile("Method Not Allowed")

EXIT_SUCCESS = 0
EXIT_CHANGE_FAILED = 1
Expand Down Expand Up @@ -767,7 +767,7 @@ def test_020_dash_o_noop(self):
EXIT_NETWORK_ERROR,
"using both -h and -O exits with value appropriate to -h value",
)
self.assertRegex(result.stderr, REGEX_NOT_FOUND)
self.assertRegex(result.stderr, REGEX_NOT_ALLOWED)

def test_030_empty_input_option(self):
result = Runner.run(["-u", IRRD_URL], ENV_EMPTY, RPSL_EMPTY)
Expand Down Expand Up @@ -841,7 +841,7 @@ def test_050_non_json_response(self):
result = Runner.run(row, ENV_EMPTY, RPSL_MINIMAL)
self.assertEqual(
result.returncode,
EXIT_RESPONSE_ERROR,
EXIT_NETWORK_ERROR,
f"Bad response URL {row[1]} exits with {EXIT_NETWORK_ERROR}",
)
self.assertRegex(result.stderr, REGEX_BAD_RESPONSE)
self.assertRegex(result.stderr, REGEX_NOT_ALLOWED)

0 comments on commit 6bddcec

Please sign in to comment.