getUsersByState with tests