Need test for rpcauth.py #12995

issue laanwj opened this issue on April 16, 2018
  1. laanwj commented at 2:31 PM on April 16, 2018: member

    There is no test for the share/rpcauth/rpcauth.py script, there should be one, and it should be part of travis.

  2. laanwj added the label Tests on Apr 16, 2018
  3. laanwj added the label Scripts and tools on Apr 16, 2018
  4. laanwj added the label good first issue on Apr 16, 2018
  5. laanwj cross-referenced this on Apr 16, 2018 from issue tests: Remove compatibility code not needed now when we're on Python 3 by practicalswift
  6. cdecker commented at 11:57 AM on April 18, 2018: contributor

    I'd like to take a stab at this, but I could use some guidance. Would this be better suited in test/util or test/functional? The latter is a bit heavier but it'd allow us to also check the correctness of the generated credentials.

  7. MarcoFalke commented at 1:05 PM on April 18, 2018: member

    We have a test in ./test/functional/rpc_users.py that has the rpcauth hardcoded. It could make sense to call into rpcauth.py and generate a fresh pair every time the test is executed.

  8. ken2812221 cross-referenced this on Apr 18, 2018 from issue test: Add rpcauth pair that generated by rpcauth.py by ken2812221
  9. cdecker commented at 3:55 PM on April 19, 2018: contributor

    Sounds like a plan, I'll take a look at it ^^

    Edit: Damn, too slow :wink:

  10. MarcoFalke removed the label good first issue on Apr 19, 2018
  11. jnewbery commented at 9:10 PM on April 19, 2018: member

    I'm NACKish on adding dependencies to the functional test framework, even if they're on internal project tools. Currently the functional tests can run anywhere. I don't think we should be adding a requirement that the /share directory is available (and certainly shouldn't be hard-coding its location relative to the test file).

  12. nixbox commented at 6:40 PM on April 22, 2018: contributor

    If I were to add unit testing for rpcauth.py, where would that go in the directory structure?

    To be more specific, since most python tests are functional tests and reside under test/functional, if i were to put the unittest for rpcauth.py under test/util, I would have no way of referencing definitions in rpcauth.py without mucking with PYTHONPATH or sys.path.

    Is it OK to put the unittest instead under share/test and then use the python unittest discover functionality to run the test?

    Any feedback would be appreciated.

  13. jnewbery commented at 10:12 PM on April 22, 2018: member

    If I were to add unit testing for rpcauth.py, where would that go in the directory structure?

    I see two options:

    1. Within the rpcauth.py module itself, using the Python standard library unittest module.
    2. In test/util, by adding the location of rpcauth.py to config.ini.in (as in https://github.com/bitcoin/bitcoin/pull/13024/commits/6be22e7db3ac815356ba14298d551bfae0e7a74c#diff-914785539d91e7b1d7ec0614606b03eeR12) and then updating sys.path.

    In either case, you should update make check to run the test.

  14. nixbox cross-referenced this on Apr 23, 2018 from issue [tests] Make rpcauth.py testable and add unit tests by nixbox
  15. laanwj closed this on Apr 24, 2018

  16. laanwj referenced this in commit 018c7e5dad on Apr 24, 2018
  17. laanwj referenced this in commit 106d929780 on Apr 25, 2018
  18. stamhe referenced this in commit c9333f3aef on Jun 27, 2018
  19. HashUnlimited referenced this in commit 8c75cfc5f6 on Sep 6, 2018
  20. HashUnlimited cross-referenced this on Sep 6, 2018 from issue [tests] Make rpcauth.py testable and add unit tests by HashUnlimited
  21. lionello referenced this in commit 79a99130f5 on Nov 7, 2018
  22. joemphilips referenced this in commit 6e355bcd0f on Nov 9, 2018
  23. dongcarl cross-referenced this on Nov 19, 2018 from issue Integration tests that use rpcauth.py by dongcarl
  24. PastaPastaPasta referenced this in commit 69651c36a0 on Jul 19, 2020
  25. PastaPastaPasta referenced this in commit da37f120c6 on Jul 19, 2020
  26. PastaPastaPasta referenced this in commit 46c368b8f1 on Jul 22, 2020
  27. PastaPastaPasta referenced this in commit d57503e469 on Jul 22, 2020
  28. bitcoin locked this on Sep 8, 2021
  29. gades referenced this in commit d3ecd3a95c on Mar 11, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:54 UTC