From 4224bcd2e2828406f442bf938287b64699be9977 Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Thu, 10 Jul 2025 00:02:10 +0800 Subject: [PATCH] fix: handle already verified users in PublishModeIntegrationTest --- .../openisle/integration/PublishModeIntegrationTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/openisle/integration/PublishModeIntegrationTest.java b/src/test/java/com/openisle/integration/PublishModeIntegrationTest.java index b2fe164a9..2bcf4515d 100644 --- a/src/test/java/com/openisle/integration/PublishModeIntegrationTest.java +++ b/src/test/java/com/openisle/integration/PublishModeIntegrationTest.java @@ -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 resp = rest.postForEntity("/api/auth/login", new HttpEntity<>( Map.of("username", username, "password", "pass123"), h), Map.class); return (String) resp.getBody().get("token");