From bf8bf68e0a02a6aaf6632a45067c201b8b1aa959 Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 20 Nov 2025 11:39:53 -0500 Subject: [PATCH 1/6] Update retrive user api to be versioned --- frontend/public/src/lib/queries/users.js | 2 +- users/urls.py | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/frontend/public/src/lib/queries/users.js b/frontend/public/src/lib/queries/users.js index f87eecf51d..f958924485 100644 --- a/frontend/public/src/lib/queries/users.js +++ b/frontend/public/src/lib/queries/users.js @@ -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..8c3c97b0bd 100644 --- a/users/urls.py +++ b/users/urls.py @@ -31,13 +31,6 @@ ), 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", From 2e059bc26a1945cae31ef79641911ae4327bbce8 Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 20 Nov 2025 11:49:21 -0500 Subject: [PATCH 2/6] me --- frontend/public/src/lib/queries/users.js | 4 ++-- users/urls.py | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/public/src/lib/queries/users.js b/frontend/public/src/lib/queries/users.js index f958924485..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 } diff --git a/users/urls.py b/users/urls.py index 8c3c97b0bd..520f529f0e 100644 --- a/users/urls.py +++ b/users/urls.py @@ -24,13 +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/", include(router.urls)), path( "api/v0/users/me", From 95899cc05b81d7651654e3d18ce78e730040dec0 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 21 Nov 2025 08:14:18 -0500 Subject: [PATCH 3/6] App test --- frontend/public/src/containers/App_test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/public/src/containers/App_test.js b/frontend/public/src/containers/App_test.js index 47dd574c15..202422d15c 100644 --- a/frontend/public/src/containers/App_test.js +++ b/frontend/public/src/containers/App_test.js @@ -45,7 +45,7 @@ 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 +65,7 @@ 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 +104,7 @@ 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, From 0007448889eaa752609adb91756a2cdca93cf2c5 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 21 Nov 2025 08:16:32 -0500 Subject: [PATCH 4/6] HeaderApp --- frontend/public/src/containers/HeaderApp_test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/public/src/containers/HeaderApp_test.js b/frontend/public/src/containers/HeaderApp_test.js index 224112ab92..6ebc326ff7 100644 --- a/frontend/public/src/containers/HeaderApp_test.js +++ b/frontend/public/src/containers/HeaderApp_test.js @@ -52,14 +52,14 @@ 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 +98,7 @@ 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, From 150e11e0a39299dd2ca904c557a7a4cdf3229b0a Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 21 Nov 2025 08:19:15 -0500 Subject: [PATCH 5/6] EditProfileForm --- .../public/src/containers/pages/profile/EditProfilePage_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 50b0377960b844cba1aefe7db0cbaf29983039a8 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 21 Nov 2025 08:27:47 -0500 Subject: [PATCH 6/6] format --- frontend/public/src/containers/App_test.js | 18 +++++++++++++++--- .../public/src/containers/HeaderApp_test.js | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/frontend/public/src/containers/App_test.js b/frontend/public/src/containers/App_test.js index 202422d15c..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/v0/users/current_user/", "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/v0/users/current_user/", "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/v0/users/current_user/", "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 6ebc326ff7..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/v0/users/current_user/", "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/v0/users/current_user/", "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/v0/users/current_user/", "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,