Merge pull request #152 from nagisa77/codex/fix-test-case-for-publishmodeintegrationtest

Fix PublishModeIntegrationTest user verification
This commit is contained in:
Tim
2025-07-10 00:03:23 +08:00
committed by GitHub

View File

@@ -36,8 +36,10 @@ class PublishModeIntegrationTest {
rest.postForEntity("/api/auth/register", new HttpEntity<>(
Map.of("username", username, "email", email, "password", "pass123"), h), Map.class);
User u = users.findByUsername(username).orElseThrow();
rest.postForEntity("/api/auth/verify", new HttpEntity<>(
Map.of("username", username, "code", u.getVerificationCode()), h), Map.class);
if (u.getVerificationCode() != null) {
rest.postForEntity("/api/auth/verify", new HttpEntity<>(
Map.of("username", username, "code", u.getVerificationCode()), h), Map.class);
}
ResponseEntity<Map> resp = rest.postForEntity("/api/auth/login", new HttpEntity<>(
Map.of("username", username, "password", "pass123"), h), Map.class);
return (String) resp.getBody().get("token");