diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_retirement_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_retirement_views.py index 57edcacf66..5a0ee21215 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_retirement_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_retirement_views.py @@ -326,7 +326,7 @@ class TestPartnerReportingCleanup(ModuleStoreTestCase): self.course_awesome_org = CourseFactory(org='awesome_org') self.headers = build_jwt_headers(self.test_superuser) self.headers['content_type'] = "application/json" - self.url = reverse('accounts_retirement_partner_report') + self.url = reverse('accounts_retirement_partner_report_cleanup') self.maxDiff = None def create_partner_reporting_statuses(self, is_being_processed=True, num=2): @@ -351,7 +351,7 @@ class TestPartnerReportingCleanup(ModuleStoreTestCase): def assert_status_and_count(self, statuses, remaining_count, expected_status=status.HTTP_204_NO_CONTENT): """ - Performs a test client DELETE against the retirement reporting cleanup endpoint. It generates + Performs a test client POST against the retirement reporting cleanup endpoint. It generates the JSON of usernames to clean up based on the given list of UserRetirementPartnerReportingStatuses, asserts that the given number of UserRetirementPartnerReportingStatus rows are still in the database after the operation, and asserts that the given expected_status HTTP status code is returned. @@ -359,7 +359,7 @@ class TestPartnerReportingCleanup(ModuleStoreTestCase): usernames = [{'original_username': u.original_username} for u in statuses] data = json.dumps(usernames) - response = self.client.delete(self.url, data=data, **self.headers) + response = self.client.post(self.url, data=data, **self.headers) print(response) print(response.content) diff --git a/openedx/core/djangoapps/user_api/accounts/views.py b/openedx/core/djangoapps/user_api/accounts/views.py index c19fba8052..fa5c3a594f 100644 --- a/openedx/core/djangoapps/user_api/accounts/views.py +++ b/openedx/core/djangoapps/user_api/accounts/views.py @@ -605,7 +605,7 @@ class AccountRetirementPartnerReportView(ViewSet): def retirement_partner_cleanup(self, request): """ - DELETE /api/user/v1/accounts/retirement_partner_report/ + POST /api/user/v1/accounts/retirement_partner_report_cleanup/ [{'original_username': 'user1'}, {'original_username': 'user2'}, ...] diff --git a/openedx/core/djangoapps/user_api/urls.py b/openedx/core/djangoapps/user_api/urls.py index ee7cbd898f..77b2f3a861 100644 --- a/openedx/core/djangoapps/user_api/urls.py +++ b/openedx/core/djangoapps/user_api/urls.py @@ -35,8 +35,11 @@ ACCOUNT_DETAIL = AccountViewSet.as_view({ PARTNER_REPORT = AccountRetirementPartnerReportView.as_view({ 'post': 'retirement_partner_report', - 'put': 'retirement_partner_status_create', - 'delete': 'retirement_partner_cleanup' + 'put': 'retirement_partner_status_create' +}) + +PARTNER_REPORT_CLEANUP = AccountRetirementPartnerReportView.as_view({ + 'post': 'retirement_partner_cleanup' }) RETIREMENT_QUEUE = AccountRetirementStatusView.as_view({ @@ -114,6 +117,11 @@ urlpatterns = [ PARTNER_REPORT, name='accounts_retirement_partner_report' ), + url( + r'^v1/accounts/retirement_partner_report_cleanup/$', + PARTNER_REPORT_CLEANUP, + name='accounts_retirement_partner_report_cleanup' + ), url( r'^v1/accounts/retirement_queue/$', RETIREMENT_QUEUE,