fix session cookies and catalog pricing visibility

This commit is contained in:
wlx committed 2026-09-25 23:09:59 +08:00
1 parent 05ed1fc9a4
commit 8a65109c80
9 files changed
+71 -25

No files matched your search

@@ -75,6 +75,7 @@ class AuthPostgresTest {
var registered = http.perform(post("/api/auth/register").contentType("application/json").content(json.writeValueAsBytes(registration)))
.andExpect(status().isCreated()).andExpect(jsonPath("$.user.role").value("user"))
.andExpect(cookie().httpOnly("moyi_session", true)).andExpect(cookie().secure("moyi_session", true))
.andExpect(cookie().maxAge("moyi_session", -1))
.andReturn().getResponse();
UUID memberId = UUID.fromString(json.readTree(registered.getContentAsString()).get("user").get("id").asText());
Cookie memberCookie = registered.getCookie("moyi_session");
@@ -106,7 +107,7 @@ class AuthPostgresTest {
private Cookie login(MockMvc http, String account, String role) throws Exception {
return http.perform(post("/api/auth/login").contentType("application/json")
.content("{\"account\":\"" + account + "\",\"password\":\"test-password\"}"))
.andExpect(status().isOk()).andExpect(jsonPath("$.user.role").value(role))
.andExpect(status().isOk()).andExpect(jsonPath("$.user.role").value(role)).andExpect(cookie().maxAge("moyi_session", -1))
.andReturn().getResponse().getCookie("moyi_session");
}
}