def test_access_by_resource_for_organization( self, forseti_cli: ForsetiCli, forseti_model_readonly, forseti_server_service_account, organization_id): """Test access_by_resource for organization includes Forseti SA. Args: forseti_cli (ForsetiCli): Instance of the forseti cli helper forseti_model_readonly (Tuple): Model name & process result forseti_server_service_account (str): Server service account email organization_id (str): Organization id being scanned """ # Arrange model_name, _, _ = forseti_model_readonly forseti_cli.model_use(model_name=model_name) # Act result = forseti_cli.explainer_access_by_resource( f'organization/{organization_id}') # Assert assert result.returncode == 0, f'Forseti stdout: {str(result.stdout)}' assert EXPECTED_COUNT_FOR_ORG == len( re.findall(forseti_server_service_account, str(result.stdout)))
def test_access_by_resource_for_project(self, forseti_cli: ForsetiCli, forseti_model_readonly, forseti_server_service_account, project_id): """Test access_by_resource for project includes Forseti SA. Args: forseti_cli (ForsetiCli): Instance of the forseti cli helper forseti_model_readonly (Tuple): Model name & process result forseti_server_service_account (str): Server service account email project_id (str): Project id being scanned """ # Arrange model_name, _, _ = forseti_model_readonly forseti_cli.model_use(model_name=model_name) # Act result = forseti_cli.explainer_access_by_resource( f'project/{project_id}') # Assert assert result.returncode == 0, f'Forseti stdout: {str(result.stdout)}' assert 17 == len( re.findall(forseti_server_service_account, str(result.stdout)))