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 test_cannot_get_users_in_another_org(self, context, test_org_user_clients, client_key): step("Create new organization") org = Organization.create(context) step( "Check that a user or org admin not in an org cannot get list of users in the org" ) client = test_org_user_clients[client_key] assert_raises_http_exception(HttpStatus.CODE_FORBIDDEN, HttpStatus.MSG_FORBIDDEN, User.get_list_in_organization, org_guid=org.guid, client=client)
def test_get_data_sets_from_another_org(self, context): step("Create another test organization") org = Organization.create(context) step("Retrieve datasets from the new org") public_datasets = [ds for ds in self.datasets if ds.is_public] private_datasets = [ds for ds in self.datasets if not ds.is_public] datasets = [ ds for ds in DataSet.api_get_list(org_guid_list=[org.guid]) ] step("Check that no private data sets are visible in another org") found_private_ds = [ds for ds in private_datasets if ds in datasets] assert found_private_ds == [], "Private datasets from another org returned" step("Check that all public data sets are visible in another org") missing_public_ds = [ ds for ds in public_datasets if ds not in datasets ] assert missing_public_ds == [], "Not all public data sets from another org returned"
def another_org(self, context): step("Create test organization") return Organization.create(context)