Skip to content

Commit

Permalink
Merge pull request #258 from ootd-zip/test/config
Browse files Browse the repository at this point in the history
test: 테스트 환경 설정
  • Loading branch information
kkmin223 authored Nov 17, 2024
2 parents c7a0ee0 + d5a0ec5 commit 3ad49f1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 72 deletions.
6 changes: 4 additions & 2 deletions src/test/java/zip/ootd/ootdzip/ControllerTestSupport.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package zip.ootd.ootdzip;

import com.fasterxml.jackson.databind.ObjectMapper;

import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import com.fasterxml.jackson.databind.ObjectMapper;

import zip.ootd.ootdzip.brandrequest.controller.BrandRequestController;
import zip.ootd.ootdzip.brandrequest.service.BrandRequestService;
import zip.ootd.ootdzip.clothes.controller.ClothesController;
Expand Down Expand Up @@ -40,6 +41,7 @@
UserBlockController.class,
BrandRequestController.class
})
@ActiveProfiles("test")
public abstract class ControllerTestSupport {

@Autowired
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/zip/ootd/ootdzip/IntegrationTestSupport.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package zip.ootd.ootdzip;

import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.test.context.ActiveProfiles;

@Transactional
@SpringBootTest
@ActiveProfiles("test")
public abstract class IntegrationTestSupport {
}
2 changes: 2 additions & 0 deletions src/test/java/zip/ootd/ootdzip/OotdzipApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

@SpringBootTest
@ActiveProfiles("test")
class OotdzipApplicationTests {

@Test
Expand Down
40 changes: 40 additions & 0 deletions src/test/resources/application-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
spring:
config:
activate:
on-profile: test
jpa:
hibernate:
ddl-auto: create-drop
show-sql: true
format_sql: true # sql 보기 편하게 출력
use_sql_comments: true
datasource:
url: jdbc:h2:mem:ootdzip
username: sa
password: 1234
driver-class-name: org.h2.Driver
profiles:
include: secret
data:
redis:
host: 127.0.0.1
port: 6379
timeout: 10

client:
base-url: https://dev.ootdzip.com
dev-url: http://localhost:3000


logging: #로그 레벨을 정하는 것
level:
org.hibernate.SQL: debug #JPA 하이버네이트가 생성하는 SQL 로그
org.hibernate.orm.jdbc.bind: debug # 스프링 3.0 이후 변경됨
zip.ootd.ootdzip.oauth.OAuth2AuthenticationFailureHandler: debug # 로그인 실패 시 로그

# Token config
authorization:
issuer: https://dev.ootdzip.com
audience: https://dev-ootdzip.com
access-token-time-to-live: 5184000 # 30 minutes
refresh-token-time-to-live: 5184000 # 60 days
68 changes: 0 additions & 68 deletions src/test/resources/application.yaml

This file was deleted.

0 comments on commit 3ad49f1

Please sign in to comment.