Refactor user API tests.