-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: Commerce Coordinator step in retirement pipeline #11
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -558,3 +558,39 @@ def test_retire_learner(self, mock_method): | |
original_username=FAKE_ORIGINAL_USERNAME | ||
) | ||
) | ||
|
||
|
||
class TestCommerceCoordinatorApi(OAuth2Mixin, unittest.TestCase): | ||
""" | ||
Test the edX Commerce-Coordinator API client. | ||
""" | ||
|
||
@responses.activate(registry=OrderedRegistry) | ||
def setUp(self): | ||
super().setUp() | ||
self.mock_access_token_response() | ||
self.lms_base_url = 'http://localhost:18000/' | ||
self.commerce_coordinator_base_url = 'http://localhost:8140/' | ||
self.commerce_coordinator_api = edx_api.CommerceCoordinatorApi( | ||
self.lms_base_url, | ||
self.commerce_coordinator_base_url, | ||
'the_client_id', | ||
'the_client_secret' | ||
) | ||
|
||
@patch.object(edx_api.CommerceCoordinatorApi, 'retire_learner') | ||
def test_retire_learner(self, mock_method): | ||
json_data = { | ||
'edx_lms_user_id': get_fake_user_retirement()['user']['id'] | ||
} | ||
responses.add( | ||
POST, | ||
urljoin(self.commerce_coordinator_base_url, 'lms/user_retirement'), | ||
match=[matchers.json_params_matcher(json_data)] | ||
) | ||
self.commerce_coordinator_api.retire_learner( | ||
learner=get_fake_user_retirement() | ||
) | ||
mock_method.assert_called_once_with( | ||
learner=get_fake_user_retirement() | ||
) | ||
Comment on lines
+591
to
+596
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you just copy+pasted this from other tests, but LOL this is quite a thin test that doesn't actually run the retire_learner function. I'm not going to block on this, but if you feel motivated---I think we'd ideally mock the underlying self._requests call. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay cool, I will make a note to create the new test once we've gotten this work through. Thank you! |
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.
Do you plan to add the
lms/user_retirement
endpoint to the commerce-coordinator service? It currently doesn't seem to exist in the django urls.py routes: https://github.com/edx/commerce-coordinator/blob/main/commerce_coordinator/apps/lms/urls.pyThere 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.
Yup! Will be merged in along with this work: https://github.com/edx/commerce-coordinator/pull/247/files#diff-d76063092b846765b0a4c6b15b4a31f3c0bad316aa7e39242bf7d9fcd422a088R19