def create_user_from_obj(user_obj): ''' Create a user based on an already formed user object ''' userModel = UserModel() created_obj = userModel.create(user_obj) compare_dicts_by_keys( ns_keys(user_obj), created_obj, ("firstName", "lastName", "email", "screenName", "companyId"))
def create_user_from_obj(user_obj): ''' Create a user based on an already formed user object ''' userModel = UserModel() created_obj = userModel.create(user_obj) compare_dicts_by_keys(ns_keys(user_obj), created_obj, ("firstName", "lastName", "email", "screenName", "companyId"))
def check_values(self, act_obj, exp_hash): ''' Takes the actual object, one expected hash, as from the lettuce step.hashes and which keys to compare. Note: the keys may be different from expected because of things like "company name" in expected, but we will get the id for that company name and compare the ids with the act_obj ''' try: exp_hash["companyId"] = CompanyModel().get_resid( exp_hash["company name"])[0] del exp_hash["company name"] except KeyError: # we may not be checking company name, and that's ok, so just pass pass # check that the data matches compare_dicts_by_keys(ns_keys(exp_hash), act_obj, exp_hash.keys())
def check_values(self, act_obj, exp_hash): ''' Takes the actual object, one expected hash, as from the lettuce step.hashes and which keys to compare. Note: the keys may be different from expected because of things like "company name" in expected, but we will get the id for that company name and compare the ids with the act_obj ''' try: exp_hash["companyId"] = CompanyModel().get_resid(exp_hash["company name"])[0] del exp_hash["company name"] except KeyError: # we may not be checking company name, and that's ok, so just pass pass # check that the data matches compare_dicts_by_keys(ns_keys(exp_hash), act_obj, exp_hash.keys())