-
Notifications
You must be signed in to change notification settings - Fork 6
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
ENT-8079 - Make DSC optional based on enterprise config #190
Merged
adamstankiewicz
merged 1 commit into
openedx:main
from
zwidekalanga:zwidekalanga/ENT-8079/make-dsc-optional
Jan 22, 2024
Merged
Changes from all commits
Commits
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 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 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 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 |
---|---|---|
|
@@ -198,7 +198,8 @@ def test_create_allocation_payload(self, mock_get_enterprise_customer_data, mock | |
else: | ||
assert geag_payload.get(geag_field) == tx_metadata.get(payload_field) | ||
|
||
def test_validate_pass(self): | ||
@mock.patch("enterprise_subsidy.apps.api_client.enterprise.EnterpriseApiClient.get_enterprise_customer_data") | ||
def test_validate_pass(self, mock_get_enterprise_customer_data): | ||
""" | ||
Ensure `_validate` method passes | ||
""" | ||
|
@@ -208,7 +209,10 @@ def test_validate_pass(self): | |
'geag_email': '[email protected]', | ||
'geag_date_of_birth': '1900-01-01', | ||
'geag_terms_accepted_at': '2021-05-21T17:32:28Z', | ||
'geag_data_share_consent': True, | ||
} | ||
mock_get_enterprise_customer_data.return_value = { | ||
'auth_org_id': 'asde23eas', | ||
'enable_data_sharing_consent': False, | ||
} | ||
transaction = TransactionFactory.create( | ||
state=TransactionStateChoices.PENDING, | ||
|
@@ -221,7 +225,8 @@ def test_validate_pass(self): | |
# pylint: disable=protected-access | ||
assert self.geag_fulfillment_handler._validate(transaction) | ||
|
||
def test_validate_fail(self): | ||
@mock.patch("enterprise_subsidy.apps.api_client.enterprise.EnterpriseApiClient.get_enterprise_customer_data") | ||
def test_validate_fail(self, mock_get_enterprise_customer_data): | ||
""" | ||
Ensure `_validate` method raises with a missing `geag_terms_accepted_at` | ||
""" | ||
|
@@ -233,6 +238,10 @@ def test_validate_fail(self): | |
'geag_terms_accepted_at': '2021-05-21T17:32:28Z', | ||
'geag_data_share_consent': True, | ||
} | ||
mock_get_enterprise_customer_data.return_value = { | ||
'auth_org_id': 'asde23eas', | ||
'enable_data_sharing_consent': True | ||
} | ||
transaction = TransactionFactory.create( | ||
state=TransactionStateChoices.PENDING, | ||
quantity=-19998, | ||
|
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.
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.
[curious] I'm wondering if it'd make sense to conditionally push
geag_data_share_consent
ontoself.REQUIRED_METADATA_FIELDS
whenenable_data_sharing_consent = True
, so that the fields listed inself.REQUIRED_METADATA_FIELDS
are truly only the required fields?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.
The issue is related to the tests since they share they same object adding more removing into the REQUIRED_METADATA_FIELDS array in causes other tests to fail which where support to pass.
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.
Got it. I suppose the other concern is that I'm not sure we'd be able to get at the appropriate enterprise customer within a class constructor, as we are relying on a specific transaction to identify the enterprise customer. I think how you have it is reasonable.