diff --git a/pom.xml b/pom.xml
index d5de2d04f..1c31f0b94 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,11 @@
mysql-connector-j
runtime
+
+ com.h2database
+ h2
+ test
+
io.jsonwebtoken
jjwt-api
diff --git a/src/test/java/com/openisle/integration/ComplexFlowIntegrationTest.java b/src/test/java/com/openisle/integration/ComplexFlowIntegrationTest.java
new file mode 100644
index 000000000..525d19e2f
--- /dev/null
+++ b/src/test/java/com/openisle/integration/ComplexFlowIntegrationTest.java
@@ -0,0 +1,115 @@
+package com.openisle.integration;
+
+import com.openisle.model.User;
+import com.openisle.repository.UserRepository;
+import com.openisle.service.EmailService;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.http.*;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+class ComplexFlowIntegrationTest {
+
+ @Autowired
+ private TestRestTemplate rest;
+
+ @Autowired
+ private UserRepository users;
+
+ @MockBean
+ private EmailService emailService;
+
+ private String registerAndLogin(String username, String email) {
+ HttpHeaders h = new HttpHeaders();
+ h.setContentType(MediaType.APPLICATION_JSON);
+ rest.postForEntity("/api/auth/register", new HttpEntity<>(
+ Map.of("username", username, "email", email, "password", "pass"), 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);
+ ResponseEntity