def core_org(): log_fixture("core_org: Create object for core org") ref_org_name = config.core_org_name orgs = Organization.get_list() core_org = next((o for o in orgs if o.name == ref_org_name), None) assert core_org is not None, "Could not find org {}".format(ref_org_name) return core_org
def test_create_and_delete_organization(context): """Create and Delete Organization""" step("Create organization") test_org = Organization.create(context) step("Check that organization is on the list") orgs = Organization.get_list() assert test_org in orgs step("Delete organization") test_org.delete() step("Check that the organization is not on the list") assertions.assert_not_in_with_retry(test_org, Organization.api_get_list)
def from_reference(cls, org_guid): from modules.tap_object_model import Application, User, Organization, ServiceOffering, ServiceInstance, DataSet metrics = [] app_down_states = [TapEntityState.FAILURE, TapEntityState.STOPPED] apps = Application.get_list() apps_count = len(apps) apps_running_count = len( [app for app in apps if app.state == TapEntityState.RUNNING]) apps_down_count = len( [app for app in apps if app.state in app_down_states]) user_count = len(User.get_all_users(org_guid)) orgs_count = len(Organization.get_list()) services_count = len(ServiceOffering.get_list()) services_inst = len([ instance for instance in ServiceInstance.get_list() if instance.state == TapEntityState.RUNNING ]) nodes = KubernetesNode.get_list() for node in nodes: metrics.append(node.get_metrics()) cpu_usage_org = cls.parse_cpu(metrics) / (cls.CPU_RATE_FOR_REF * cls.NODE) cpu_usage_platform = cls.parse_cpu(metrics) / (cls.CPU_RATE_FOR_REF * cls.NODE) memory_usage_org = cls.parse_memory(metrics) memory_usage_platform = cls.parse_memory(metrics) datasets = DataSet.api_get_list(org_guid_list=[org_guid]) return cls(apps=apps_count, apps_running=apps_running_count, apps_down=apps_down_count, users_org=user_count, users_platform=user_count, orgs=orgs_count, services=services_count, service_instances=services_inst, service_usage=services_inst, cpu_usage_org=cpu_usage_org, memory_usage_org=memory_usage_org, cpu_usage_platform=cpu_usage_platform, memory_usage_platform=memory_usage_platform, datasets=datasets)
def test_login(): """ <b>Description:</b> Checks if login to platform works. <b>Input data:</b> 1. User name. 2. Password. <b>Expected results:</b> Test passes when user was logged successfully into platform. <b>Steps:</b> 1. Log into platform. 2. Get organization list and verify that it's not None. """ orgs_list = Organization.get_list() assert orgs_list is not None