[tests] Make rpcauth.py testable and add unit tests#13056
Conversation
|
Some lint issues: Also the test fails to launch: |
|
Fixed the lint issues. Fixed the "No such file or directory" problem as well. |
|
utACK ebff14786b7addd4bcc6e74691394a77019f2bf6 |
jnewbery
left a comment
There was a problem hiding this comment.
A few nits inline after testing.
There was a problem hiding this comment.
nit: seems like somewhat random placement. Why not alphabetically sorted like the rest?
There was a problem hiding this comment.
nit: prefer _ for unused loop variables.
There was a problem hiding this comment.
nit: prefer docstrings for function-level comments.
There was a problem hiding this comment.
No need to use parens here. Just:
password, password_hmac = generate_password(salt)
(you could also change the return statement in generate_password() to return password, password_hmac, but under the covers Python will construct a tuple to return anyway, so it's equivalent.)
There was a problem hiding this comment.
nit: prefer string formatters ({} or % - we can't use f-strings yet).
If you must concatenate strings, please surround the + with spaces so the code isn't so difficult to parse.
There was a problem hiding this comment.
I think this is unnecessary - this is for python2 compatibility. We now no longer support python2 across the project.
There was a problem hiding this comment.
nit: prefer with open() as: for opening files.
|
Mistakenly did a force push. Addressed all of your nits. Thanks for the feedback! |
jnewbery
left a comment
There was a problem hiding this comment.
couple more nits inline
There was a problem hiding this comment.
Docstrings should be the first statement inside the function (https://www.python.org/dev/peps/pep-0257/#what-is-a-docstring)
There was a problem hiding this comment.
nit: use os.path.join() for maximum portability (instead of concat'ing path strings)
There was a problem hiding this comment.
Also, should probably say config_path
There was a problem hiding this comment.
Could do a rebase, since this is already in master?
|
Tested ACK 6674a75. Travis failure was unrelated failure in |
|
All green, ready to go? |
Add rpcauth-test (introduced bitcoin#13056) to AC_CONFIG_LINKS, like the other directly called python scripts, to fix out-of-tree `make check`.
…-tree make check 3e53004 test: add rpcauth-test to AC_CONFIG_LINKS to fix out-of-tree make check (Wladimir J. van der Laan) Pull request description: Add rpcauth-test (introduced #13056) to AC_CONFIG_LINKS, like the other directly called python scripts, to fix out-of-tree `make check`. (forgot to test this before merging, unfortunately) Tree-SHA512: 60306ac83ee81e0f27d5b4f0420c3bd4edfa3fd5daaa067ff0c235eb55da9f6c559203c2625fed97783b2d11d9f1bed7a359b4d9204ab4af75fd1fd24b9882a8
Add rpcauth-test (introduced bitcoin#13056) to AC_CONFIG_LINKS, like the other directly called python scripts, to fix out-of-tree `make check`.
Add rpcauth-test (introduced bitcoin#13056) to AC_CONFIG_LINKS, like the other directly called python scripts, to fix out-of-tree `make check`.
6674a75 [tests] Make rpcauth.py testable and add unit tests (Qasim Javed) Pull request description: refs bitcoin#12995 Tree-SHA512: 609a85a75dafe46723f050db1e96098f6859519afd5e1b141a332f34ab715144d32fdd8f10d245d6dc0765e77f82158fe7b8aa2e4317f0e893de491d2e0acf1f
… out-of-tree make check 3e53004 test: add rpcauth-test to AC_CONFIG_LINKS to fix out-of-tree make check (Wladimir J. van der Laan) Pull request description: Add rpcauth-test (introduced bitcoin#13056) to AC_CONFIG_LINKS, like the other directly called python scripts, to fix out-of-tree `make check`. (forgot to test this before merging, unfortunately) Tree-SHA512: 60306ac83ee81e0f27d5b4f0420c3bd4edfa3fd5daaa067ff0c235eb55da9f6c559203c2625fed97783b2d11d9f1bed7a359b4d9204ab4af75fd1fd24b9882a8
refs #12995