1- package com .somemore .center .service ;
1+ package com .somemore .user .service ;
22
33import com .somemore .center .domain .NEWCenter ;
4- import com .somemore .center .dto .request .CenterProfileImgUpdateRequestDto ;
54import com .somemore .center .repository .NEWCenterRepository ;
6- import com .somemore .global .imageupload .usecase .ImageUploadUseCase ;
75import com .somemore .support .IntegrationTestSupport ;
86import com .somemore .user .domain .UserCommonAttribute ;
7+ import com .somemore .user .dto .request .ImgUrlRequestDto ;
98import com .somemore .user .repository .usercommonattribute .UserCommonAttributeRepository ;
109import org .junit .jupiter .api .DisplayName ;
1110import org .junit .jupiter .api .Test ;
1615import java .util .UUID ;
1716
1817import static com .somemore .user .domain .UserRole .CENTER ;
19- import static org .junit .jupiter .api .Assertions .*;
2018import static org .assertj .core .api .Assertions .assertThat ;
19+ import static org .junit .jupiter .api .Assertions .assertTrue ;
2120
2221@ Transactional
23- class UpdateCenterProfileImgServiceTest extends IntegrationTestSupport {
22+ class UpdateProfileImgServiceTest extends IntegrationTestSupport {
2423
2524 @ Autowired
26- private UpdateCenterProfileImgService updateCenterProfileImgService ;
27-
28- @ Autowired
29- private ImageUploadUseCase imageUploadUseCase ;
25+ private UpdateProfileImgUrlService updateCenterProfileImgService ;
3026
3127 @ Autowired
3228 private NEWCenterRepository centerRepository ;
3329
3430 @ Autowired
3531 private UserCommonAttributeRepository userCommonAttributeRepository ;
3632
37- @ DisplayName ("파일명을 받아 기관 프로필 이미지의 presignedUrl을 발급해준다." )
33+ @ DisplayName ("파일명을 받아 프로필 이미지의 presignedUrl을 발급해준다." )
3834 @ Test
3935 void updateCenterProfileImg () {
4036
@@ -43,25 +39,19 @@ void updateCenterProfileImg() {
4339
4440 NEWCenter center = NEWCenter .createDefault (userId );
4541 centerRepository .save (center );
46- UUID centerId = center .getId ();
4742
4843 UserCommonAttribute userCommonAttribute = UserCommonAttribute .createDefault (userId , CENTER );
4944 userCommonAttributeRepository .save (userCommonAttribute );
5045
51- CenterProfileImgUpdateRequestDto requestDto = new CenterProfileImgUpdateRequestDto ("test.png" );
52-
5346 //when
54- String presignedUrl = updateCenterProfileImgService .updateCenterProfileImg ( centerId , requestDto );
47+ String presignedUrl = updateCenterProfileImgService .update ( userId , new ImgUrlRequestDto ( "test.png" ) );
5548
5649 //then
5750 assertThat (presignedUrl ).isNotNull ();
5851
5952 Optional <UserCommonAttribute > updatedUserCommonAttribute = userCommonAttributeRepository .findByUserId (userId );
6053 assertThat (updatedUserCommonAttribute )
6154 .isNotNull ();
62- assertTrue (updatedUserCommonAttribute .get ().getImgUrl ().contains (requestDto .fileName ()));
63-
55+ assertTrue (updatedUserCommonAttribute .get ().getImgUrl ().contains ("test.png" ));
6456 }
65-
66-
6757}
0 commit comments