def get_new_user_by_id(step): userModel = UserModel() last_created_user = userModel.get_latest_stored() user_id = get_resource_identity(last_created_user)[0] user_obj = userModel.get_by_id(user_id) compare_dicts_by_keys(last_created_user, user_obj, ("firstName", "lastName", "email", "screenName", "companyId"))
def get_new_user_by_id(step): userModel = UserModel() last_created_user = userModel.get_latest_stored() user_id = get_resource_identity(last_created_user)[0] user_obj = userModel.get_by_id(user_id) compare_dicts_by_keys( last_created_user, user_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 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 fetch_results_by_ids(step, stored_testrun, testrun_name): testrunModel = TestrunModel() testcaseModel = TestcaseModel() testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name) testrun_id = get_resource_identity(testrun)[0] for testcase in step.hashes: # for each testcase name, fetch the result that matches it in the testrun list testcase_obj = testcaseModel.get_by_name(testcase["name"]) testcase_id = get_resource_identity(testcase_obj)[0] result_from_list = testrunModel.get_result(testcase_id, testrun_id = testrun_id) testresult_id = get_resource_identity(result_from_list)[0] result_from_endpoint = testrunModel.get_result_by_id(testresult_id) compare_dicts_by_keys(result_from_list, result_from_endpoint, ("testCaseId", "testRunId", "testSuiteId"))
def fetch_results_by_ids(step, stored_testrun, testrun_name): testrunModel = TestrunModel() testcaseModel = TestcaseModel() testrun = testrunModel.get_stored_or_store_obj(stored_testrun, testrun_name) testrun_id = get_resource_identity(testrun)[0] for testcase in step.hashes: # for each testcase name, fetch the result that matches it in the testrun list testcase_obj = testcaseModel.get_by_name(testcase["name"]) testcase_id = get_resource_identity(testcase_obj)[0] result_from_list = testrunModel.get_result(testcase_id, testrun_id=testrun_id) testresult_id = get_resource_identity(result_from_list)[0] result_from_endpoint = testrunModel.get_result_by_id(testresult_id) compare_dicts_by_keys(result_from_list, result_from_endpoint, ("testCaseId", "testRunId", "testSuiteId"))
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())