test and fix user api
improve resttest code