-
Notifications
You must be signed in to change notification settings - Fork 0
feat: encode email and IP address in cluster options #108
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
18b2699
feat: encode email and ip for cluster options
vtnphan 766acff
test: fix encoded email in cluster options
vtnphan 1a9806e
refactor: encode user email and IP address
vtnphan eaf7ca3
Merge branch 'dev' into sbp-481-extension
vtnphan adddbe6
chore: lint
vtnphan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,20 +221,20 @@ def test_get_proteindj_config_text_appends_process_block(): | |
| assert "clusterOptions" in result | ||
|
|
||
|
|
||
| def test_get_proteindj_config_text_contains_email_and_encoded_ip(): | ||
| def test_get_proteindj_config_text_contains_encoded_email_and_encoded_ip(): | ||
| with patch("builtins.open", mock_open(read_data="base_config")): | ||
| result = get_proteindj_config_text("/fake/proteindj.config", user_details=_USER_DETAILS) | ||
| assert "[email protected]" in result | ||
| assert "dXNlckBleC5jb20=" in result | ||
| assert "MS4yLjMuNA==" in result | ||
|
|
||
|
|
||
| def test_get_proteindj_config_text_without_ip_uses_email_only(): | ||
| def test_get_proteindj_config_text_without_ip_uses_encoded_email_only(): | ||
| with patch("builtins.open", mock_open(read_data="base_config")): | ||
| result = get_proteindj_config_text( | ||
| "/fake/proteindj.config", | ||
| user_details=_USER_DETAILS.model_copy(update={"ip_address": ""}), | ||
| ) | ||
| assert "-A [email protected]" in result | ||
| assert "-A dXNlckBleC5jb20=" in result | ||
| assert ":" not in result.split("clusterOptions = ")[1] | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -547,23 +547,23 @@ def test_get_proteinfold_config_text_appends_process_block(): | |
| assert "clusterOptions" in result | ||
|
|
||
|
|
||
| def test_get_proteinfold_config_text_contains_email_and_encoded_ip(): | ||
| def test_get_proteinfold_config_text_contains_encoded_email_and_encoded_ip(): | ||
| with patch("builtins.open", mock_open(read_data="base_config")): | ||
| result = get_proteinfold_config_text( | ||
| "/fake/proteinfold.config", | ||
| user_details=_USER_DETAILS, | ||
| ) | ||
| assert "[email protected]" in result | ||
| assert "dXNlckBleC5jb20=" in result | ||
| assert "MS4yLjMuNA==" in result | ||
|
|
||
|
|
||
| def test_get_proteinfold_config_text_without_ip_uses_email_only(): | ||
| def test_get_proteinfold_config_text_without_ip_uses_encoded_email_only(): | ||
| with patch("builtins.open", mock_open(read_data="base_config")): | ||
| result = get_proteinfold_config_text( | ||
| "/fake/proteinfold.config", | ||
| user_details=_USER_DETAILS.model_copy(update={"ip_address": ""}), | ||
| ) | ||
| assert "-A [email protected]" in result | ||
| assert "-A dXNlckBleC5jb20=" in result | ||
| assert ":" not in result.split("clusterOptions = ")[1] | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| WorkflowLaunchForm, | ||
| WorkflowLaunchPayload, | ||
| WorkflowLaunchResponse, | ||
| WorkflowUserDetails, | ||
| map_pipeline_status_to_ui, | ||
| single_prediction_size_limit, | ||
| validate_single_prediction_entities, | ||
|
|
@@ -467,6 +468,16 @@ def test_interaction_screening_request_extra_fields_forbidden(): | |
| ) | ||
|
|
||
|
|
||
| def test_get_encoded_account_details_encodes_email_and_ip(): | ||
| details = WorkflowUserDetails(user_email="[email protected]", ip_address="1.2.3.4") | ||
| assert details.get_encoded_account_details() == "dXNlckBleGFtcGxlLmNvbQ==:MS4yLjMuNA==" | ||
|
|
||
|
|
||
| def test_get_encoded_account_details_without_ip_encodes_email_only(): | ||
| details = WorkflowUserDetails(user_email="[email protected]", ip_address="") | ||
| assert details.get_encoded_account_details() == "dXNlckBleGFtcGxlLmNvbQ==" | ||
|
|
||
|
|
||
| # ============================================================================= | ||
| # Single-prediction entity validation | ||
| # ============================================================================= | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,7 +145,7 @@ def test_get_bindflow_config_text_interpolates_email(): | |
| "/fake/bindflow.config", | ||
| user_details=_user_details("[email protected]"), | ||
| ) | ||
| assert "-A [email protected]" in result | ||
| assert "-A YWxpY2VAZXhhbXBsZS5jb20=" in result | ||
|
|
||
|
|
||
| def test_get_bindflow_config_text_without_ip_address_omits_encoding(): | ||
|
|
@@ -154,7 +154,7 @@ def test_get_bindflow_config_text_without_ip_address_omits_encoding(): | |
| "/fake/bindflow.config", | ||
| user_details=_user_details("[email protected]"), | ||
| ) | ||
| assert "-A [email protected]" in result | ||
| assert "-A dXNlckBleGFtcGxlLmNvbQ==" in result | ||
| assert ":" not in result.split("clusterOptions = ")[1] | ||
|
|
||
|
|
||
|
|
@@ -164,7 +164,7 @@ def test_get_bindflow_config_text_with_ip_address_appends_encoded_ip(): | |
| "/fake/bindflow.config", | ||
| user_details=_user_details("[email protected]", ip_address="1.2.3.4"), | ||
| ) | ||
| assert "-A [email protected]:MS4yLjMuNA==" in result | ||
| assert "-A dXNlckBleGFtcGxlLmNvbQ==:MS4yLjMuNA==" in result | ||
|
|
||
|
|
||
| def test_get_bindflow_config_text_url_fetching(): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,23 +262,23 @@ def test_get_wisps_config_text_appends_process_block(): | |
| assert "clusterOptions" in result | ||
|
|
||
|
|
||
| def test_get_wisps_config_text_contains_email_and_encoded_ip(): | ||
| def test_get_wisps_config_text_contains_encoded_email_and_encoded_ip(): | ||
| with patch("builtins.open", mock_open(read_data="base_config")): | ||
| result = get_wisps_config_text( | ||
| config_file_path="/fake/path.config", | ||
| user_details=_USER_DETAILS, | ||
| ) | ||
| assert "[email protected]" in result | ||
| assert "dXNlckBleC5jb20=" in result | ||
| assert "MS4yLjMuNA==" in result | ||
|
|
||
|
|
||
| def test_get_wisps_config_text_without_ip_uses_email_only(): | ||
| def test_get_wisps_config_text_without_ip_uses_encoded_email_only(): | ||
| with patch("builtins.open", mock_open(read_data="base_config")): | ||
| result = get_wisps_config_text( | ||
| config_file_path="/fake/path.config", | ||
| user_details=_USER_DETAILS.model_copy(update={"ip_address": ""}), | ||
| ) | ||
| assert "-A [email protected]" in result | ||
| assert "-A dXNlckBleC5jb20=" in result | ||
| assert ":" not in result.split("clusterOptions = ")[1] | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.