The Watcher used to receive a secret key file path ion the __init__ to load a secret key for signing. That made testing the Watcher hard, since the file needed to be present. Changing it so the main (pisad) loads the file from disk and passes the data the Watcher on init.
- All encryption/decryption and signing/verifying calls are performed by the cryptographer now.
- The current signature format is temporal. We should define something not base on json.
- Some Cryptographer tests are still missing.
- The cli tests should be modified to fit this too.
- Adds a PRG based on a hardcoded seed to make the tests reproducible (get_random_value_hex)
- Updates all the tests replacing urandom for get_random_value_hex
- Properly places misplaced bitcoin_cli in bitcoin_sim_tests
- Typos
bitcoin_cli as a global variable in the main __init__.py was creating issues related to http.client.CannotSendRequest: Request-sent and connection re-usage. Define a new connection per request.
The modules that need to run either bitcoind or the api do now reference to the fixture in the first test that needs it. Since the fixtures are definexd session-wise the rest of the modules will have access to them from that point on.
test_get_all_appointments_responder was failing unconsistently. It was due to how the api fixture was set up.
Fix:
- Sets up bitcoind and api fixtures to run session-wise (so they are not re-initialized for every test
- Updates tests accordingly (e.g. reduces the number of MULTIPLE_REQUESTS so it does not cap)
- Keeps track of all sent appointments so the test_request functionds don't need to create additional ones
- Adds unit tests for API
- Updates API to let BlockProcessor deal with block block related JSON-RPC
- Fixes BlockProcessor get_potential_matches return
- Makes bitcoin_sim runnable via function (instead of a main runnable script) to work with pytests fixture
- <3 Fixture