I’m in a situation where I want to write unit test for my API service which is consumed by a mobile app. The mobile app uses auth0 for authentication and the API right now authenticates the user using JWT. I have created a new test account for this purpose on auth0 and I have no problem of signing up users (with random emails) using the AuthenticationClient. After I had tested this once I saw that I had created quite the amount of users in my database and thought to myself, let me just make sure to clear out all of the users from auth0 before running my test each time, but I can not find a bulk way to do this. The ManagementClient only offers to delete one user at a time, which would in effect cause me to spam auth0 with requests for deleting every single user each time I’m running my tests. So it feels like I’m going down the wrong track here and I would love some input on how to write test cases like this and all input is much appreciated.
@kasper you’re correct that we don’t currently have a bulk user delete endpoint. I think the answer would depend on how many users you are creating, and how often the tests are run. If you are within the rate-limits, you should be fine. The only other implication would be the number of users you create, which may have an effect on your plan. Depending on how often you run these tests, you could create the user, then delete it at the end of the test.
We don’t currently have a bulk user delete endpoint. I think the answer would depend on how many users you are creating, and how often the tests are run. If you are within the rate-limits, you should be fine. The only other implication would be the number of users you create, which may have an effect on your plan. Depending on how often you run these tests, you could create the user, then delete it at the end of the test.
Thank you for your feedback. I have now implemented it with deleting the user at the end of the test and it actually works pretty solid for writing integration tests. I really appreciate your feedback.