-
Notifications
You must be signed in to change notification settings - Fork 378
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
Process encrypted secret by the target #7252
Process encrypted secret by the target #7252
Conversation
09070f4
to
858bb8e
Compare
c0f30ff
to
1151e56
Compare
1151e56
to
32c55c7
Compare
4d45b86
to
08d0143
Compare
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.
LGTM
Very nice that we could get rid of the elif dispatch boilerplate...
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.
Im just requesting changes so that it does not get merged accidentally. We figured out that decryption of the secret is currently not tested and that it should not work because of a missing targetstate because ActionTargetInit
is never applied.
dd9e858
to
1f308ca
Compare
3d1d85b
to
cf8bbe5
Compare
79a1814
to
1c7219d
Compare
1c7219d
to
f3ada0c
Compare
f3ada0c
to
ded77fc
Compare
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.
This time LGTM for real ;)
Please see my comment on the test patching below.
This can be done in a follow up PR though so as not to hold this up any longer.
@@ -937,7 +939,10 @@ def test_channel_events_raiden( | |||
@pytest.mark.parametrize("number_of_nodes", [3]) | |||
@pytest.mark.parametrize("channels_per_node", [CHAIN]) | |||
@pytest.mark.parametrize("enable_rest_api", [True]) | |||
def test_pending_transfers_endpoint(raiden_network: List[RaidenService], token_addresses): | |||
@patch("raiden.message_handler.decrypt_secret", side_effect=InvalidSecret) |
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.
We usually use pytest's monkeypatch
fixture instead of patch
in the test suite (although not always...).
The advantage is that the monkeypatch fixture is integrated with pytest and also defaults to raising an exception if the patch target doesn't exist (e.g. after a refactoring) which is not the case with patch
.
I think it would be nicer to put this into a fixture and / or test helper (e.g. disable_encrypted_secret
) so as not having to repeat this patch boilerplate on many tests (which would need to be changed if ever the decrypt_secret
function was moved or otherwise refactored).
Also this only tests the branch where the included secret is invalid, not the one where none is provided in the first place.
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.
Created #7287 for this
Process encrypted secret by the target
Fixes: #7157