Remove the duplicate code in tests

* This could be the cause of the UserAuth JUnit tests taking longer than expected.