refactered getuser to accept user object and return json string and added a test