-
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
FC-0001: Replace usages enterprise_catalogs Enterprise API V1 #3742
base: master
Are you sure you want to change the base?
FC-0001: Replace usages enterprise_catalogs Enterprise API V1 #3742
Conversation
Thanks for the pull request, @ruzniaievdm! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
@@ -564,24 +563,29 @@ def mock_enterprise_catalog_api(self, enterprise_customer_uuid, raise_exception= | |||
Helper function to register the enterprise catalog API endpoint. | |||
""" | |||
enterprise_catalog_api_response = { | |||
'count': 10, |
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 should be the total number of results which should not change because we're mocking a single page in the response I think.
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 change does not make sense, becouse we're mocking, returned as it was
ecommerce/enterprise/tests/mixins.py
Outdated
'num_pages': 3, | ||
'current_page': 2, | ||
'count': 2, | ||
'next': urljoin(self.ENTERPRISE_CATALOG_URL, f'?enterprise_customer={enterprise_customer_uuid}/'), |
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.
If this is meant to imitate page 2 of the response, I think the the next url would be different.
'next': urljoin(self.ENTERPRISE_CATALOG_URL, f'?enterprise_customer={enterprise_customer_uuid}/'), | |
'next': urljoin(self.ENTERPRISE_CATALOG_URL, f'?page=3&page_size=2'), |
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.
enterprise_customer
query shouldn't be included?
I did not simulate 2 page of the answer but changed response
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.
I think in the old API, it would using the customer_uuid as a way of figuring out what the first customer to display is. But the new API doesn't have that feature, it just does paging. If you haven't already done so, you should make sure any non test calls to this endpoint don't pass the enterprise_customer
parameter.
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.
Hm, do you mean that the new enterprise-catalog
endpoint should not accept a query parameter enterprise_customer
? Because this implementation I moved to the new endpoint
pr to enterprise-catalog: https://github.com/openedx/enterprise-catalog/pull/468/files
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.
Ah, gotcha, hadn't gotten to that PR yet, makes sense. But you still need paging information for the next URL right? If the endpoint is meant to provide more results on a second page, the URL for that should be consistent. It sounds like it would include the enterprise_customer
but also the next page number and page size.
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.
you are right, have already been added those changes
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 looks good to me, I think it's good to merge once the setting has been added to site-configuration and we've updated the wiki page for olive to mention the settings change.
@@ -560,14 +615,14 @@ def get_enterprise_catalog(site, enterprise_catalog, limit, page, endpoint_reque | |||
|
|||
api_client = site.siteconfiguration.oauth_api_client | |||
enterprise_api_url = urljoin( | |||
f"{site.siteconfiguration.enterprise_api_url}/", | |||
f"{resource}/{str(enterprise_catalog)}/" | |||
f"{site.siteconfiguration.enterprise_catalog_api_url}/", |
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 change probably deserves some sort of change log entry, at the very least we should update the olive page to tell people the old setting will not work and they'll need to add this new setting to properly connect ecommerce to the enterprise catalog.
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 still needs to be done on the olive page and linked back to here before this PR is ready to merge.
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.
@dianakhuang can you help confirm that this setting is set in stage and prod for edx.org? I think if it is, then this is safe to merge.
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 particular I just want to confirm that settings.ENTERPRISE_CATALOG_API_URL
is set correctly since this is just a passthrough for that.
@feanil Thanks! Before merging I want to rebase to one commit |
@feanil I leave clarifications and comments in discussions, please take a look |
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 is pretty close to landing at this point I think. Just a few small things to hash out.
ecommerce/enterprise/tests/mixins.py
Outdated
'num_pages': 3, | ||
'current_page': 2, | ||
'count': 2, | ||
'next': urljoin(self.ENTERPRISE_CATALOG_URL, f'?enterprise_customer={enterprise_customer_uuid}/'), |
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.
Ah, gotcha, hadn't gotten to that PR yet, makes sense. But you still need paging information for the next URL right? If the endpoint is meant to provide more results on a second page, the URL for that should be consistent. It sounds like it would include the enterprise_customer
but also the next page number and page size.
@@ -560,14 +615,14 @@ def get_enterprise_catalog(site, enterprise_catalog, limit, page, endpoint_reque | |||
|
|||
api_client = site.siteconfiguration.oauth_api_client | |||
enterprise_api_url = urljoin( | |||
f"{site.siteconfiguration.enterprise_api_url}/", | |||
f"{resource}/{str(enterprise_catalog)}/" | |||
f"{site.siteconfiguration.enterprise_catalog_api_url}/", |
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 still needs to be done on the olive page and linked back to here before this PR is ready to merge.
ebaaaa9
to
cba2cc2
Compare
rebased to one commit |
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.
I've updated the olive page with the relevant changes, @dianakhuang if you confirm the one setting exists then I think this is good to merge.
@natabene this is ready for 2U review. |
This PR is scheduled for review the week of Nov 7. |
@colinbrash Hi there! Just seeing if this is ready to be merged? |
@colinbrash can you let us known when this can be schedule for review? |
(1 of 5) for closes openedx/public-engineering#61
Latest: openedx/edx-enterprise#1582
Description:
Replace these usages1 usages2 with corresponding to the enterprise-catalog service