Skip to content

Commit b22615e

Browse files
committed
refactor(auth api): fix test error
1 parent 1eff0c8 commit b22615e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

apollo-portal/src/test/java/com/ctrip/framework/apollo/SkipAuthorizationConfiguration.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class SkipAuthorizationConfiguration {
4242
@Bean
4343
public ConsumerPermissionValidator consumerPermissionValidator() {
4444
final ConsumerPermissionValidator mock = mock(ConsumerPermissionValidator.class);
45-
when(mock.hasCreateNamespacePermission(any(), any())).thenReturn(true);
45+
when(mock.hasCreateNamespacePermission(any())).thenReturn(true);
4646
return mock;
4747
}
4848

@@ -61,7 +61,7 @@ public ConsumerAuthUtil consumerAuthUtil() {
6161
}
6262

6363
@Primary
64-
@Bean("permissionValidator")
64+
@Bean("userPermissionValidator")
6565
public UserPermissionValidator permissionValidator() {
6666
final UserPermissionValidator mock = mock(UserPermissionValidator.class);
6767
when(mock.isSuperAdmin()).thenReturn(true);

apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/v1/controller/AppControllerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public class AppControllerTest {
107107
@Test
108108
public void testFindAppsAuthorized() throws Exception {
109109
final long consumerId = 123456;
110-
Mockito.when(this.consumerAuthUtil.retrieveConsumerId(Mockito.any())).thenReturn(consumerId);
110+
Mockito.when(this.consumerAuthUtil.retrieveConsumerIdByCtx()).thenReturn(consumerId);
111111

112112
final List<ConsumerRole> consumerRoles = Arrays.asList(
113113
generateConsumerRoleByRoleId(6),

apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/v1/controller/NamespaceControllerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class NamespaceControllerTest extends AbstractControllerTest {
3939

4040
@Test
4141
public void shouldFailWhenAppNamespaceNameIsInvalid() {
42-
Assert.assertTrue(consumerPermissionValidator.hasCreateNamespacePermission(null, null));
42+
Assert.assertTrue(consumerPermissionValidator.hasCreateNamespacePermission(null));
4343

4444
OpenAppNamespaceDTO dto = new OpenAppNamespaceDTO();
4545
dto.setAppId("appId");

0 commit comments

Comments
 (0)