diff --git a/frontend/public/src/containers/App_test.js b/frontend/public/src/containers/App_test.js index 47dd574c15..e4566ba9f5 100644 --- a/frontend/public/src/containers/App_test.js +++ b/frontend/public/src/containers/App_test.js @@ -45,7 +45,11 @@ describe("Top-level App", () => { const { inner } = await renderPage() assert.notExists(inner.find(".app").prop("children")) - sinon.assert.calledWith(helper.handleRequestStub, "/api/users/me", "GET") + sinon.assert.calledWith( + helper.handleRequestStub, + "/api/v0/users/current_user/", + "GET" + ) }) it("fetches user data on load and renders user in the header", async () => { @@ -65,7 +69,11 @@ describe("Top-level App", () => { const { inner } = await renderPage() // So we look to be sure the next child is there, which is
, which is not there otherwise assert.exists(inner.find("Header")) - sinon.assert.calledWith(helper.handleRequestStub, "/api/users/me", "GET") + sinon.assert.calledWith( + helper.handleRequestStub, + "/api/v0/users/current_user/", + "GET" + ) }) it("adds a user notification if a stored message is found in cookies", async () => { @@ -104,7 +112,11 @@ describe("Top-level App", () => { }) await renderPage() // Should call /api/users/me to get user data - sinon.assert.calledWith(helper.handleRequestStub, "/api/users/me", "GET") + sinon.assert.calledWith( + helper.handleRequestStub, + "/api/v0/users/current_user/", + "GET" + ) // Should NOT call the cart items count API for unauthenticated users sinon.assert.neverCalledWith( helper.handleRequestStub, diff --git a/frontend/public/src/containers/HeaderApp_test.js b/frontend/public/src/containers/HeaderApp_test.js index 224112ab92..54ae69ab23 100644 --- a/frontend/public/src/containers/HeaderApp_test.js +++ b/frontend/public/src/containers/HeaderApp_test.js @@ -52,14 +52,22 @@ describe("Top-level HeaderApp", () => { inner.update() // So we look to be sure the next child is there, which is
assert.exists(inner.find("Header")) - sinon.assert.calledWith(helper.handleRequestStub, "/api/users/me", "GET") + sinon.assert.calledWith( + helper.handleRequestStub, + "/api/v0/users/current_user/", + "GET" + ) }) it("tries to fetch user data and no response or an incorrect response renders nothing", async () => { helper.handleRequestStub.returns({}) const { inner } = await renderPage() assert.notExists(inner.find("div").prop("children")) - sinon.assert.calledWith(helper.handleRequestStub, "/api/users/me", "GET") + sinon.assert.calledWith( + helper.handleRequestStub, + "/api/v0/users/current_user/", + "GET" + ) }) it("adds a user notification if a stored message is found in cookies", async () => { @@ -98,7 +106,11 @@ describe("Top-level HeaderApp", () => { }) await renderPage() // Should call /api/users/me to get user data - sinon.assert.calledWith(helper.handleRequestStub, "/api/users/me", "GET") + sinon.assert.calledWith( + helper.handleRequestStub, + "/api/v0/users/current_user/", + "GET" + ) // Should NOT call the cart items count API for unauthenticated users sinon.assert.neverCalledWith( helper.handleRequestStub, diff --git a/frontend/public/src/containers/pages/profile/EditProfilePage_test.js b/frontend/public/src/containers/pages/profile/EditProfilePage_test.js index 32eecc4061..69f14320df 100644 --- a/frontend/public/src/containers/pages/profile/EditProfilePage_test.js +++ b/frontend/public/src/containers/pages/profile/EditProfilePage_test.js @@ -62,7 +62,7 @@ describe("EditProfilePage", () => { await inner.find("EditProfileForm").prop("onSubmit")(values, actions) sinon.assert.calledWith( helper.handleRequestStub, - "/api/users/me", + "/api/v0/users/me", "PATCH", { body: values, diff --git a/frontend/public/src/lib/queries/users.js b/frontend/public/src/lib/queries/users.js index f87eecf51d..065e7736c9 100644 --- a/frontend/public/src/lib/queries/users.js +++ b/frontend/public/src/lib/queries/users.js @@ -31,7 +31,7 @@ const DEFAULT_OPTIONS = { export default { currentUserQuery: () => ({ - url: "/api/users/me", + url: "/api/v0/users/current_user/", transform: transformCurrentUser, update: updateResult }), @@ -48,7 +48,7 @@ export default { ...DEFAULT_OPTIONS, transform: transformCurrentUser, update: updateResult, - url: "/api/users/me", + url: "/api/v0/users/me", body: { ...profileData } @@ -57,7 +57,7 @@ export default { ...DEFAULT_OPTIONS, transform: transformCurrentUser, update: updateResult, - url: "/api/users/current_user", + url: "/api/v0/users/current_user", body: { ...profileData } diff --git a/users/urls.py b/users/urls.py index 9cff996c08..520f529f0e 100644 --- a/users/urls.py +++ b/users/urls.py @@ -24,20 +24,6 @@ router.register(r"user_search", UsersViewSet, basename="users_search_api") urlpatterns = [ - path( - "api/users/me", - CurrentUserRetrieveUpdateViewSet.as_view( - {"patch": "update", "get": "retrieve"} - ), - name="users_api-me", - ), - path( - "api/users/current_user/", - NewCurrentUserRetrieveUpdateViewSet.as_view( - {"patch": "update", "get": "retrieve"} - ), - name="users_api-current_user", - ), path("api/", include(router.urls)), path( "api/v0/users/me",