기본 그룹 insert sql 추가

This commit is contained in:
geek 2019-07-21 00:03:02 +09:00
parent 73b5ba7545
commit 1cc236a683
3 changed files with 23 additions and 6 deletions

View File

@ -12,11 +12,11 @@ spring:
data-username: postgres data-username: postgres
password: qwer5795 password: qwer5795
username: postgres username: postgres
# JPA properties # JPA properties
initialization-mode: never
jpa: jpa:
hibernate: hibernate:
ddl-auto: create-drop ddl-auto: update
database: postgresql database: postgresql
show-sql: true show-sql: true
database-platform: org.hibernate.dialect.PostgreSQLDialect database-platform: org.hibernate.dialect.PostgreSQLDialect

View File

@ -0,0 +1,14 @@
insert into public.tbl_user_group
(id ,title, description, is_default, register_date)
values
(1, '관리자', '관리자 그룹', false, '2019-07-20 12:00:30');
insert into public.tbl_user_group
(id ,title, description, is_default, register_date)
values
(2, '정회원', '정회원 그룹', true, '2019-07-20 12:00:30');
insert into public.tbl_user_group
(id ,title, description, is_default, register_date)
values
(3, '비회원', '비회원 그룹', false, '2019-07-20 12:00:30');

View File

@ -38,13 +38,16 @@ public class UserRepositoryTest {
@Test @Test
public void findByUsername() throws Exception { public void findByUsername() throws Exception {
User tempUser = user.build(); User admin = this.userRepository.findByUsername("admin");
if (admin == null) {
User tempUser = user.build();
this.userRepository.save(tempUser); this.userRepository.save(tempUser);
User user1 = this.userRepository.findByUsername(tempUser.getUsername()); User user1 = this.userRepository.findByUsername(tempUser.getUsername());
assertEquals("Equlas", user.build().getUsername(), user1.getUsername()); assertEquals("Equlas", user.build().getUsername(), user1.getUsername());
}
} }
@Test @Test