Skip to content

Commit

Permalink
Removes unecessary mock calls
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Dec 19, 2024
1 parent 9abd1d0 commit 53169bc
Showing 1 changed file with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,11 @@ public void issueOnBehalfOfToken_success() throws Exception {
@Test
public void issueApiToken_success() throws Exception {
doAnswer(invockation -> new ClusterName("cluster17")).when(cs).getClusterName();
doAnswer(invocation -> true).when(tokenManager).issueApiTokenAllowed();
final ThreadContext threadContext = new ThreadContext(Settings.EMPTY);
threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER, new User("Jon", List.of(), null));
when(threadPool.getThreadContext()).thenReturn(threadContext);
final ConfigModel configModel = mock(ConfigModel.class);
tokenManager.onConfigModelChanged(configModel);
when(configModel.mapSecurityRoles(any(), any())).thenReturn(Set.of());

createMockJwtVendorInTokenManager();

Expand All @@ -276,13 +274,11 @@ public void issueApiToken_success() throws Exception {
@Test
public void encryptCallsJwtEncrypt() throws Exception {
doAnswer(invockation -> new ClusterName("cluster17")).when(cs).getClusterName();
doAnswer(invocation -> true).when(tokenManager).issueApiTokenAllowed();
final ThreadContext threadContext = new ThreadContext(Settings.EMPTY);
threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER, new User("Jon", List.of(), null));
when(threadPool.getThreadContext()).thenReturn(threadContext);
final ConfigModel configModel = mock(ConfigModel.class);
tokenManager.onConfigModelChanged(configModel);
when(configModel.mapSecurityRoles(any(), any())).thenReturn(Set.of());

createMockJwtVendorInTokenManager();

Expand Down

0 comments on commit 53169bc

Please sign in to comment.