Test case cleanup and password bug fix

Add users test, factor out common test case helper routines. FIx bug
where password was being overwritten by null on update.