Skip to content

Commit

Permalink
Merge pull request #78 from IoTeaTime/test/77-kan-132-user-domain-rename
Browse files Browse the repository at this point in the history
fix: 테스트코드 user 도메인 이름 변경
  • Loading branch information
ywonchae1 authored Nov 5, 2024
2 parents 3294f7f + 35e6260 commit 9a374d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.ioteatime.meonghanyangserver.device.repository.DeviceRepository;
import org.ioteatime.meonghanyangserver.group.domain.GroupEntity;
import org.ioteatime.meonghanyangserver.group.repository.GroupRepository;
import org.ioteatime.meonghanyangserver.user.domain.UserEntity;
import org.ioteatime.meonghanyangserver.user.repository.UserRepository;
import org.ioteatime.meonghanyangserver.member.domain.MemberEntity;
import org.ioteatime.meonghanyangserver.member.repository.MemberRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -26,24 +26,24 @@
@SpringBootTest
class CctvControllerTest extends ControllerTestConfig {
@Autowired private JwtUtils jwtUtils;
@Autowired private UserRepository userRepository;
@Autowired private MemberRepository memberRepository;
@Autowired private CctvRepository cctvRepository;
@Autowired private GroupRepository groupRepository;
@Autowired private DeviceRepository deviceRepository;

private String accessToken;
private UserEntity user;
private MemberEntity member;

@BeforeEach
public void beforeEach() {
user =
UserEntity.builder()
member =
MemberEntity.builder()
.email("[email protected]")
.nickname("test")
.password("testpassword")
.build();
userRepository.save(user);
accessToken = jwtUtils.includeBearer(jwtUtils.generateAccessToken(user));
memberRepository.save(member);
accessToken = jwtUtils.includeBearer(jwtUtils.generateAccessToken(member));
}

@Test
Expand All @@ -53,7 +53,7 @@ public void beforeEach() {

DeviceEntity device2 =
DeviceEntity.builder()
.user(user)
.member(member)
.group(group)
.deviceUuid("test2")
.role(DeviceRole.ROLE_CCTV)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.ioteatime.meonghanyangserver.config.mock;

import org.ioteatime.meonghanyangserver.user.domain.UserEntity;
import org.ioteatime.meonghanyangserver.user.dto.CustomUserDetail;
import org.ioteatime.meonghanyangserver.member.domain.MemberEntity;
import org.ioteatime.meonghanyangserver.member.dto.CustomUserDetail;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
Expand All @@ -13,8 +13,8 @@ public class WithCustomMockUserSecurityContextFactory
public SecurityContext createSecurityContext(WithCustomMockUser annotation) {
String userId = annotation.userId();

UserEntity user = UserEntity.builder().id(Long.parseLong(userId)).build();
CustomUserDetail customUserDetail = new CustomUserDetail(user);
MemberEntity member = MemberEntity.builder().id(Long.parseLong(userId)).build();
CustomUserDetail customUserDetail = new CustomUserDetail(member);

UsernamePasswordAuthenticationToken token =
new UsernamePasswordAuthenticationToken(
Expand Down

0 comments on commit 9a374d4

Please sign in to comment.