listaccounts can return a dictionary from account names to their balance

if the param as_dict is True, update tests.