Skip to content

Commit

Permalink
feat(NF-777): Fix other tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crow08 committed Nov 6, 2023
1 parent 18add66 commit d87bc2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,4 @@ AuthorizationService allowAllAuthorizationService() {
public PolicyRepositoryResource policyRepositoryResource() {
return new PolicyRepositoryResource();
}

@Primary
@Bean
public PlatformTransactionManager transactionManager() {
return new PlatformTransactionManager() {
@Override
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
return null;
}

@Override
public void commit(TransactionStatus status) throws TransactionException {

}

@Override
public void rollback(TransactionStatus status) throws TransactionException {

}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,4 @@ MockObjectStoreService objectStoreService() {
ClusterLockFactory noOpLock() {
return new LocalLockFactory();
}


// TODO: replace this with a real transaction manager
@Primary
@Bean
public PlatformTransactionManager transactionManager() {
return new PlatformTransactionManager() {
@Override
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
return null;
}

@Override
public void commit(TransactionStatus status) throws TransactionException {

}

@Override
public void rollback(TransactionStatus status) throws TransactionException {

}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
Expand Down Expand Up @@ -126,10 +127,10 @@ public void testThat_documentCreationWithMetadataVerifiesAuthorization() throws

@Test
public void testThat_documentUpdateWithMetadataVerifiesAuthorization() throws JsonProcessingException {
given(mockAuthService.authorizeSubResourceUpdate(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceCreate(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceDelete(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceGet(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceUpdate(any(), any(String[].class))).willReturn(true);
given(mockAuthService.authorizeSubResourceCreate(any(), any(String[].class))).willReturn(true);
given(mockAuthService.authorizeSubResourceDelete(any(), any(String[].class))).willReturn(true);
given(mockAuthService.authorizeSubResourceGet(any(), any(String[].class))).willReturn(true);

givenVanillaExistingMetadata();

Expand Down Expand Up @@ -182,10 +183,10 @@ public void testThat_metadataRetrieveVerifiesAuthorization() throws JsonProcessi

@Test
public void testThat_metadataUpdateVerifiesAuthorization() throws JsonProcessingException {
given(mockAuthService.authorizeSubResourceUpdate(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceCreate(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceDelete(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceGet(any(), any())).willReturn(true);
given(mockAuthService.authorizeSubResourceUpdate(any(), any(String[].class))).willReturn(true);
given(mockAuthService.authorizeSubResourceCreate(any(), any(String[].class))).willReturn(true);
given(mockAuthService.authorizeSubResourceDelete(any(), any(String[].class))).willReturn(true);
given(mockAuthService.authorizeSubResourceGet(any(), any(String[].class))).willReturn(true);

givenVanillaExistingMetadata();

Expand Down

0 comments on commit d87bc2f

Please sign in to comment.