# Integration test for custom procedures using dbms.security

**URL:** <https://community.neo4j.com/t/integration-test-for-custom-procedures-using-dbms-security/17669>\
**Category:** Neo4j Graph Platform\
**Tags:** custom, procedure\
**Created:** [April 27, 2020, 2:41pm UTC](https://community.neo4j.com/t/integration-test-for-custom-procedures-using-dbms-security/17669 "2020-04-27T14:41:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LampicJ15](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/lampicj15/32/7441_2.png) [@LampicJ15](https://community.neo4j.com/u/LampicJ15)\
**Post date:** [April 27, 2020, 2:41pm UTC](https://community.neo4j.com/t/integration-test-for-custom-procedures-using-dbms-security/17669/1 "2020-04-27T14:41:46Z")

</div>

Hey,

I am writing a custom procedure which calls the procedure `dbms.security.listUsers()`  
(`db.execute("CALL dbms.security.listUsers()")`) but when I try to write an integration test  
for the procedure I get the following error:

`There is no procedure with the name `dbms.security.listUsers` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.`

How do I add the `dbms.security` procedures to the Neo4j test harness, so that I can test my procedure?

Thank you in advance for the response 😄

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [April 27, 2020, 6:54pm UTC](https://community.neo4j.com/t/integration-test-for-custom-procedures-using-dbms-security/17669/2 "2020-04-27T18:54:50Z")

</div>

You need to have the enterprise jars on classpath _and_ you need to explicitly register the procedures to be used for the test. Registration is different in 3.5 and 4.0, see [neo4j-apoc-procedures/TestUtil.java at 4.0 · neo4j-contrib/neo4j-apoc-procedures · GitHub](https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/4.0/src/test/java/apoc/util/TestUtil.java#L117-L128) for 4.0 and [neo4j-apoc-procedures/TestUtil.java at 3.5 · neo4j-contrib/neo4j-apoc-procedures · GitHub](https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/3.5/src/test/java/apoc/util/TestUtil.java#L109-L116) for 3.5

---

<div class="post-metadata">

**Author:** ![LampicJ15](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/lampicj15/32/7441_2.png) [@LampicJ15](https://community.neo4j.com/u/LampicJ15)\
**Post date:** [April 28, 2020, 7:42pm UTC](https://community.neo4j.com/t/integration-test-for-custom-procedures-using-dbms-security/17669/3 "2020-04-28T19:42:48Z")

</div>

@stefan.armbruster thank you for the quick response.  
I have all enterprise jars on my classpath and have registered the `dbms.security` procedures  
with:

`TestUtils.registerProcedure(db, UserManagementProcedures.class);`

from [neo4j-apoc-procedures/TestUtil.java at 3.5 · neo4j-contrib/neo4j-apoc-procedures · GitHub](https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/3.5/src/test/java/apoc/util/TestUtil.java#L109-L116).

But now I get the following exception and don't know how to continue

`org.neo4j.kernel.api.exceptions.ComponentInjectionException: Unable to set up injection for procedure `UserManagementProcedures`, the field `securityContext`has type`class org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext` which is not a known injectable component.`

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [April 29, 2020, 8:58am UTC](https://community.neo4j.com/t/integration-test-for-custom-procedures-using-dbms-security/17669/4 "2020-04-29T08:58:33Z")

</div>

Shouldn't you be using `SecurityContext` instead of `EnterpriseSecurityContext` in you code?
