-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: rest /tx with an invalid/unknown txid #24054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc73f53 to
a6376a8
Compare
jonatack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK a6376a823d9862342d9f3542349e81912c4bdb69
A couple of (more self-documenting?) ideas for fun, feel free to ignore.
invalid_txid = "abc"
resp = self.test_rest_request(uri=f"/tx/{invalid_txid}", ret_type=RetType.OBJ, status=400)
assert_equal(resp.read().decode('utf-8').rstrip(), f"Invalid hash: {invalid_txid}")
unknown_txid ="0000000000000000000000000000000000000000000000000000000000000000"
resp = self.test_rest_request(uri=f"/tx/{unknown_txid}", ret_type=RetType.OBJ, status=404)
assert_equal(resp.read().decode('utf-8').rstrip(), f"{unknown_txid} not found") invalid_txid = "abc"
unknown_txid = "0000000000000000000000000000000000000000000000000000000000000000"
for tx in [{'id': invalid_txid, 'status': 400, 'error': f"Invalid hash: {invalid_txid}"},
{'id': unknown_txid, 'status': 404, 'error': f"{unknown_txid} not found"}]:
resp = self.test_rest_request(uri=f"/tx/{tx['id']}", status=tx['status'], ret_type=RetType.OBJ)
assert_equal(resp.read().decode('utf-8').rstrip(), tx['error'])a6376a8 to
6e3caa9
Compare
|
force-pushed addressing @jonatack's comment. Instead of creating |
6e3caa9 to
bd52684
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
kallewoof
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK bd52684
|
Posthumous ACK |
bd52684 test: rest /tx with an invalid/unknown txid (brunoerg) Pull request description: This PR adds test coverage to the endpoint `/tx` (rest) passing an invalid and an unknown txid to test its return. Invalid -> should return status code 400 (bad request) Unknown -> should return status code 404 (not found) ACKs for top commit: kallewoof: ACK bd52684 Tree-SHA512: a7fbb63f30d06fc0855133a36e8317c7930ba13aa2b4a2dd1fc35079d59eacace72e1ffe7ae1b3e067066fe51792415940d72d923e83a659a0d5965e4110b32a
This PR adds test coverage to the endpoint
/tx(rest) passing an invalid and an unknown txid to test its return.Invalid -> should return status code 400 (bad request)
Unknown -> should return status code 404 (not found)