mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-06-03 20:44:40 +00:00
test: mock captcha service and fix auth helper
This commit is contained in:
@@ -4,6 +4,7 @@ import com.openisle.model.User;
|
||||
import com.openisle.service.EmailSender;
|
||||
import com.openisle.service.JwtService;
|
||||
import com.openisle.service.UserService;
|
||||
import com.openisle.service.CaptchaService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -34,6 +35,8 @@ class AuthControllerTest {
|
||||
private JwtService jwtService;
|
||||
@MockBean
|
||||
private EmailSender emailService;
|
||||
@MockBean
|
||||
private CaptchaService captchaService;
|
||||
|
||||
@Test
|
||||
void registerSendsEmail() throws Exception {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.openisle.model.Comment;
|
||||
import com.openisle.model.Post;
|
||||
import com.openisle.model.User;
|
||||
import com.openisle.service.CommentService;
|
||||
import com.openisle.service.CaptchaService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -30,6 +31,8 @@ class CommentControllerTest {
|
||||
|
||||
@MockBean
|
||||
private CommentService commentService;
|
||||
@MockBean
|
||||
private CaptchaService captchaService;
|
||||
|
||||
private Comment createComment(Long id, String content, String authorName) {
|
||||
User user = new User();
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.openisle.model.Category;
|
||||
import com.openisle.service.PostService;
|
||||
import com.openisle.service.CommentService;
|
||||
import com.openisle.service.ReactionService;
|
||||
import com.openisle.service.CaptchaService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -37,6 +38,8 @@ class PostControllerTest {
|
||||
private CommentService commentService;
|
||||
@MockBean
|
||||
private ReactionService reactionService;
|
||||
@MockBean
|
||||
private CaptchaService captchaService;
|
||||
|
||||
@Test
|
||||
void createAndGetPost() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user