Add User factory and refactor tests