Test #1
@@ -167,11 +167,14 @@ class MemberServiceTest {
|
||||
@Test void shouldHandleCase11() {
|
||||
UpdateMemberRequest request = new UpdateMemberRequest("测试成员", null, null,
|
||||
"EMPLOYEE", null, List.of());
|
||||
when(auth.revokeSessions(anyString(), any())).thenReturn(ApiResponse.success(null));
|
||||
|
||||
service.update(100L, 20L, request,
|
||||
Set.of("merchant:member:edit", "merchant:member:grant-role"));
|
||||
|
||||
verify(repository).replaceRoles(100L, 20L, List.of());
|
||||
verify(auth).revokeSessions(eq("internal-token"),
|
||||
eq(new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(40L))));
|
||||
}
|
||||
|
||||
@Test void shouldHandleCase12() {
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
@@ -154,12 +155,15 @@ class PlatformInternalUserServiceTest {
|
||||
IamRole role = new IamRole();
|
||||
role.setId(41L); role.setTenantId(0L); role.setAppCode("PLATFORM"); role.setStatus("ACTIVE");
|
||||
when(roleMapper.selectById(41L)).thenReturn(role);
|
||||
when(auth.revokeSessions(anyString(), any())).thenReturn(ApiResponse.success(null));
|
||||
|
||||
InternalUserResponse result = service.assignRoles(30L,
|
||||
new AssignInternalUserRolesRequest(List.of(41L, 41L)));
|
||||
|
||||
assertEquals(List.of(41L), result.roleIds());
|
||||
verify(repository).replaceRoles(0L, 30L, List.of(41L));
|
||||
verify(auth).revokeSessions(eq("internal-token"),
|
||||
eq(new AuthAccountClient.RevokeAccountSessionsRequest(Set.of(10L))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user