use of org.neo4j.internal.kernel.api.security.TestAccessMode in project neo4j by neo4j.
the class NodeTransactionStateTestBase method shouldNotCountRemovedNodesFromTxStateRestrictedUser.
@Test
void shouldNotCountRemovedNodesFromTxStateRestrictedUser() throws Exception {
// Given
Node node1 = createNode("label");
Node node2 = createNode("label");
SecurityContext loginContext = new SecurityContext(AuthSubject.AUTH_DISABLED, new TestAccessMode(true, false, true, false), EMBEDDED_CONNECTION, null);
try (KernelTransaction tx = beginTransaction(loginContext)) {
// when
tx.dataWrite().nodeDelete(node2.node);
long countTxState = tx.dataRead().countsForNode(node1.labels[0]);
long countNoTxState = tx.dataRead().countsForNodeWithoutTxState(node1.labels[0]);
// then
assertEquals(1, countTxState);
assertEquals(2, countNoTxState);
}
}
use of org.neo4j.internal.kernel.api.security.TestAccessMode in project neo4j by neo4j.
the class NodeTransactionStateTestBase method shouldNotCountRemovedLabelsFromTxStateRestrictedUser.
@Test
void shouldNotCountRemovedLabelsFromTxStateRestrictedUser() throws Exception {
// Given
Node node1 = createNode("label");
Node node2 = createNode("label");
SecurityContext loginContext = new SecurityContext(AuthSubject.AUTH_DISABLED, new TestAccessMode(true, false, true, false), EMBEDDED_CONNECTION, null);
try (KernelTransaction tx = beginTransaction(loginContext)) {
// when
tx.dataWrite().nodeRemoveLabel(node2.node, node2.labels[0]);
long countTxState = tx.dataRead().countsForNode(node1.labels[0]);
long countNoTxState = tx.dataRead().countsForNodeWithoutTxState(node1.labels[0]);
// then
assertEquals(1, countTxState);
assertEquals(2, countNoTxState);
}
}
Aggregations