白名单
This commit is contained in:
parent
e0c4b72d4e
commit
f735b0a9a3
@ -23,8 +23,9 @@ import org.springframework.stereotype.Service;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RoomRegionFilterCommon {
|
public class RoomRegionFilterCommon {
|
||||||
|
|
||||||
// account 1001041, 1001545
|
// account 1001035, 1001041, 1001545
|
||||||
private static final Set<Long> ALL_REGION_ROOM_WHITELIST_USER_IDS = Set.of(
|
private static final Set<Long> ALL_REGION_ROOM_WHITELIST_USER_IDS = Set.of(
|
||||||
|
2044358825183604738L,
|
||||||
2044700023064686594L,
|
2044700023064686594L,
|
||||||
2047206645188063233L
|
2047206645188063233L
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.red.circle.other.app.common.room;
|
package com.red.circle.other.app.common.room;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@ -14,6 +16,16 @@ import org.junit.jupiter.api.Test;
|
|||||||
|
|
||||||
class RoomRegionFilterCommonTest {
|
class RoomRegionFilterCommonTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void canViewAllRegions_shouldAllowConfiguredWhiteListUser() {
|
||||||
|
UserRegionGateway userRegionGateway = mock(UserRegionGateway.class);
|
||||||
|
RoomRegionFilterCommon roomRegionFilterCommon = new RoomRegionFilterCommon(userRegionGateway);
|
||||||
|
|
||||||
|
assertTrue(roomRegionFilterCommon.canViewAllRegions(2044358825183604738L));
|
||||||
|
assertFalse(roomRegionFilterCommon.canViewAllRegions(1001035L));
|
||||||
|
assertFalse(roomRegionFilterCommon.canViewAllRegions(null));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void filterActiveVoiceRoomsByRegion_shouldKeepOnlyCurrentRegionRooms() {
|
void filterActiveVoiceRoomsByRegion_shouldKeepOnlyCurrentRegionRooms() {
|
||||||
UserRegionGateway userRegionGateway = mock(UserRegionGateway.class);
|
UserRegionGateway userRegionGateway = mock(UserRegionGateway.class);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user