def check_group_environement_foo_existence(step, stored, name, existence): model = EnvironmenttypeModel() name = model.get_stored_or_store_name(stored, name) model.verify_existence_on_root(name, existence = existence, params = {"name": name, "groupType": True})
def check_group_environmenttype_with_name(step, stored, name, is_group): envtypeModel = EnvironmenttypeModel() name = envtypeModel.get_stored_or_store_name(stored, name) groupType = (is_group.strip() == "a group") env_type = envtypeModel.get_by_name(name) eq_(env_type[ns("groupType")], groupType, "GroupType match check")
def create_environmenttype_with_name(step, group, stored, name): ''' This creates an environmenttype that applies to an environmentGroup object ''' groupType = (group.strip() == "group environmenttype") envtypeModel = EnvironmenttypeModel() name = envtypeModel.get_stored_or_store_name(stored, name) post_payload = { "name": name, "groupType": groupType, "companyId": CompanyModel().get_seed_resid()[0] } envtypeModel.create(post_payload)
def create_environmentgroup_with_name(step, stored, name, type_name): model = EnvironmentgroupModel() name = model.get_stored_or_store_name(stored, name) type_resid = EnvironmenttypeModel().get_resid(type_name)[0] post_payload = { "name": name, "description": "oh, this old thing...", "companyId": CompanyModel().get_seed_resid()[0], "environmentTypeId": type_resid } model.create(post_payload)
def create_environmentgroups(step): model = EnvironmentgroupModel() for envgrp in step.hashes: type_resid = EnvironmenttypeModel().get_resid(envgrp["environmenttype name"],)[0] post_payload = { "name": envgrp["name"], "description": envgrp["description"], "companyId": CompanyModel().get_seed_resid()[0], "environmentTypeId": type_resid } model.create(post_payload)
def at_least_these_environments_exist(step): model = EnvironmentModel() env_list = model.get_all_list() # walk through all the expected roles and make sure it has them all # note, it doesn't check that ONLY these roles exist. That should be a different # method. for env in step.hashes: env_name = env["name"] envtype_id = EnvironmenttypeModel().get_resid(env["type"])[0] found_env = [x for x in env_list if ((x[ns("name")] == env_name) and (x[ns("environmentTypeId")] == envtype_id))] assert (len(found_env) == 1), \ "Expected to find environment with name %s and environmentTypeId of %s in:\n%s" % \ (env_name, envtype_id, jstr(env_list))
def create_environment_with_name(step, stored, name, type_name): ''' This creates an environmenttype that applies to an environment object ''' model = EnvironmentModel() name = model.get_stored_or_store_name(stored, name) type_resid = EnvironmenttypeModel().get_resid(type_name)[0] params = { "name": name, "companyId": CompanyModel().get_seed_resid()[0], "environmentTypeId": type_resid } model.create(params)
def check_environementtype_existence(step, stored, name, existence): model = EnvironmenttypeModel() name = model.get_stored_or_store_name(stored, name) model.verify_existence_on_root(name, existence = existence)
def delete_environmenttype_with_name(step, stored, name): envtypeModel = EnvironmenttypeModel() name = envtypeModel.get_stored_or_store_name(stored, name) envtypeModel.delete(name)