Skip to content

Commit

Permalink
[FEAT] Auth Test : SIGN_IN , SIGN_UP
Browse files Browse the repository at this point in the history
  • Loading branch information
jinjoo-lab committed Nov 23, 2023
1 parent 445503d commit 9c01755
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Optional;
import java.util.UUID;
Expand All @@ -17,5 +18,5 @@ public interface MemberRepository extends JpaRepository<Member, UUID> {
@Query(
"SELECT m FROM Member m WHERE m.oauthInfo.clientId = :oAuthId AND"
+ " m.oauthInfo.authType = :authType")
Optional<Member> findByOAuthIdAndAuthType(String oAuthId, AuthType authType);
Optional<Member> findByOAuthIdAndAuthType(@Param("oAuthId") String oAuthId, @Param("authType") AuthType authType);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.twtw.backend.domain.member.repository.RefreshTokenRepository;
import com.twtw.backend.fixture.member.MemberEntityFixture;
import com.twtw.backend.support.database.DatabaseTest;
import com.twtw.backend.support.exclude.ExcludeTest;
import org.junit.jupiter.api.DisplayName;

import org.junit.jupiter.api.Test;
Expand All @@ -19,7 +20,7 @@

@DatabaseTest
@DisplayName("AuthService의 ")
public class AuthServiceTest {
public class AuthServiceTest extends ExcludeTest {

@Autowired private AuthService authService;

Expand All @@ -40,10 +41,12 @@ void saveMemberKakao(){
AuthType.KAKAO
)
);

// when
AfterLoginResponse response = authService.saveMember(kakaoRequest);

// then
assertThat(response.getStatus().equals(AuthStatus.SIGNIN));
assertThat(response.getStatus().equals(AuthStatus.SIGNIN)).isTrue();
}

@Test
Expand All @@ -58,10 +61,12 @@ void saveMemberApple(){
AuthType.APPLE
)
);

// when
AfterLoginResponse response = authService.saveMember(appleRequest);

// then
assertThat(response.getStatus().equals(AuthStatus.SIGNIN));
assertThat(response.getStatus().equals(AuthStatus.SIGNIN)).isTrue();
}

@Test
Expand All @@ -79,6 +84,6 @@ void getTokenByOAuthSuccess(){
AfterLoginResponse response = authService.getTokenByOAuth(request);

// then
assertThat(response.getStatus().equals(AuthStatus.SIGNIN));
assertThat(response.getStatus().equals(AuthStatus.SIGNIN)).isTrue();
}
}

0 comments on commit 9c01755

Please sign in to comment.