Added User factory and fixed tests