Skip to content

Commit

Permalink
[SP-6512] - Backport of PPP-5053 - Intercepting few Get request with …
Browse files Browse the repository at this point in the history
…Burp Suite allows un-authorised user to access data (9.3 Suite) - Test Fix
  • Loading branch information
renato-s committed Apr 10, 2024
1 parent cdfb51f commit 39a3689
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.mockStatic;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.nullable;
import static org.mockito.Mockito.spy;
Expand All @@ -88,6 +89,8 @@ public class SolutionImportHandlerTest {
private IUnifiedRepository repository;
private IRoleAuthorizationPolicyRoleBindingDao roleAuthorizationPolicyRoleBindingDao;
private IPlatformMimeResolver mockMimeResolver;
private static MockedStatic<PentahoSystem> pentahoSystem;
IAuthorizationPolicy policy = mock( IAuthorizationPolicy.class );

@Before
public void setUp() throws Exception {
Expand All @@ -105,6 +108,11 @@ public void setUp() throws Exception {

when( importHandler.getImportSession() ).thenReturn( mock( ImportSession.class ) );
when( importHandler.getLogger() ).thenReturn( mock( Log.class ) );

pentahoSystem = mockStatic( PentahoSystem.class );

pentahoSystem.when( () -> PentahoSystem.get( eq( IAuthorizationPolicy.class ) ) ).thenReturn( policy );
when( policy.isAllowed( anyString() ) ).thenReturn( true );
}

private <T> T mockToPentahoSystem( Class<T> cl ) {
Expand Down Expand Up @@ -708,5 +716,7 @@ public void testFileIsScheduleInputSource() {
public void tearDown() throws Exception {
ImportSession.getSession().getImportedScheduleJobIds().clear();
PentahoSystem.clearObjectFactory();

pentahoSystem.close();
}
}

0 comments on commit 39a3689

Please sign in to comment.