-
Notifications
You must be signed in to change notification settings - Fork 253
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
fix: Embargo API fixed with new product type. #4034
base: master
Are you sure you want to change the base?
Conversation
'user': user.username, | ||
# ip variable is None when testing it locally, giving it dummy string "test_local_ip" | ||
# just to bypass the API, otherwise API returns "Missing Parameters" response. | ||
'ip_address': ip or "test_local_ip", |
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 should not have a test string hard coded here, especially if it's only for local testing. if we need behavior that varies whether you are in a local dev environment vs stage/prod, i recommend we instead use a config variable that, if true, will override what the ip
variable with something that works. that way, we prevent a user from potentially spoofing the values in their context to trigger this test behavior
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.
in addition to my inline comment, please update the unit tests to account for the change in the logic here 👍
product_class_name = product.get_product_class().name | ||
|
||
# We are checking Seats & Course Entitlement | ||
if product_class_name == SEAT_PRODUCT_CLASS_NAME or product_class_name == COURSE_ENTITLEMENT_PRODUCT_CLASS_NAME: |
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 last time when I reported this issue I tried using the same fix but it didn't work since for course entitlement products we didn't have course attribute set on them and hence the code would raise attribute errors as far as I remember. I would recommend double checking the code by debugging it locally and testing all the scenarios.
Course Entitlement
to be checked by Embargo while adding to the bucket.test_local_ip
to bypass API checks for local testing.