# Path: capirca/aclgen.py
# FLAGS = flags.FLAGS
# def SetupFlags():
# def SkipLines(text, skip_line_func=False):
# def RenderFile(base_directory: str, input_file: pathlib.Path,
#                output_directory: pathlib.Path, definitions: naming.Naming,
#                exp_info: int, optimize: bool, shade_check: bool,
#                write_files: WriteList):
# def RenderACL(acl_text: str,
#               acl_suffix: str,
#               output_directory: pathlib.Path,
#               input_file: pathlib.Path,
#               write_files: List[Tuple[pathlib.Path, str]],
#               binary: bool = False):
# def FilesUpdated(file_name: pathlib.Path, new_text: str, binary: bool) -> bool:
#     def P4Tags(text: str) -> bool:
# def DescendDirectory(input_dirname: str,
#                      ignore_directories: List[str]) -> List[pathlib.Path]:
#     def Filtering(path, ignored=ignored_directory):
# def WriteFiles(write_files: WriteList):
# def _WriteFile(output_file: pathlib.Path, file_contents: str):
# def Run(base_directory: str, definitions_directory: str, policy_file: str,
#         output_directory: str, exp_info: int, max_renderers: int,
#         ignore_directories: List[str], optimize: bool, shade_check: bool,
#         context: multiprocessing.context.BaseContext):
# def main(argv):
# def EntryPoint():
# class Error(Exception):
# class P4WriteFileError(Error):
# class ACLGeneratorError(Error):
# class ACLParserError(Error):


import multiprocessing
import os
import pathlib
import shutil
import sys
import tempfile
from unittest import mock
from absl import app
from absl import flags
from absl.testing import absltest
from capirca import aclgen
        'sample_multitarget.acl',
        'sample_multitarget.asa',
        'sample_multitarget.bacl',
        'sample_multitarget.eacl',
        'sample_multitarget.ipt',
        'sample_multitarget.jcl',
        'sample_multitarget.msmpc',
        'sample_multitarget.xacl',
        'sample_multitarget.nxacl',
        'sample_nsxv.nsx',
        'sample_packetfilter.pf',
        'sample_speedway.ipt',
        'sample_srx.srx',
        'sample_paloalto.xml',
        'sample_stateful_multitarget_simple.xml',
        'sample_stateful_multitarget_simple.srx',
        'sample_stateful_multitarget_complex.xml',
        'sample_stateful_multitarget_complex.srx',
        'sample_k8s.yml',
    ]
    expected = [
        mock.call(pathlib.Path(self.test_subdirectory, f), mock.ANY)
        for f in files
    ]
    mock_writer.assert_has_calls(expected, any_order=True)

  @mock.patch.object(aclgen, '_WriteFile', autospec=True)
  def test_generate_single_policy(self, mock_writer):
    policy_file = os.path.join(self.test_subdirectory,
                               'policies/pol/sample_cisco_lab.pol')

# Path: capirca/aclgen.py
# FLAGS = flags.FLAGS
# def SetupFlags():
# def SkipLines(text, skip_line_func=False):
# def RenderFile(base_directory: str, input_file: pathlib.Path,
#                output_directory: pathlib.Path, definitions: naming.Naming,
#                exp_info: int, optimize: bool, shade_check: bool,
#                write_files: WriteList):
# def RenderACL(acl_text: str,
#               acl_suffix: str,
#               output_directory: pathlib.Path,
#               input_file: pathlib.Path,
#               write_files: List[Tuple[pathlib.Path, str]],
#               binary: bool = False):
# def FilesUpdated(file_name: pathlib.Path, new_text: str, binary: bool) -> bool:
#     def P4Tags(text: str) -> bool:
# def DescendDirectory(input_dirname: str,
#                      ignore_directories: List[str]) -> List[pathlib.Path]:
#     def Filtering(path, ignored=ignored_directory):
# def WriteFiles(write_files: WriteList):
# def _WriteFile(output_file: pathlib.Path, file_contents: str):
# def Run(base_directory: str, definitions_directory: str, policy_file: str,
#         output_directory: str, exp_info: int, max_renderers: int,
#         ignore_directories: List[str], optimize: bool, shade_check: bool,
#         context: multiprocessing.context.BaseContext):
# def main(argv):
# def EntryPoint():
# class Error(Exception):
# class P4WriteFileError(Error):
# class ACLGeneratorError(Error):
# class ACLParserError(Error):


# Path: tests/integration/aclgen_test.py
import multiprocessing
import os
import pathlib
import shutil
import sys
import tempfile
from unittest import mock
from absl import app
from absl import flags
from absl.testing import absltest
from capirca import aclgen

        'sample_multitarget.acl',
        'sample_multitarget.asa',
        'sample_multitarget.bacl',
        'sample_multitarget.eacl',
        'sample_multitarget.ipt',
        'sample_multitarget.jcl',
        'sample_multitarget.msmpc',
        'sample_multitarget.xacl',
        'sample_multitarget.nxacl',
        'sample_nsxv.nsx',
        'sample_packetfilter.pf',
        'sample_speedway.ipt',
        'sample_srx.srx',
        'sample_paloalto.xml',
        'sample_stateful_multitarget_simple.xml',
        'sample_stateful_multitarget_simple.srx',
        'sample_stateful_multitarget_complex.xml',
        'sample_stateful_multitarget_complex.srx',
        'sample_k8s.yml',
    ]
    expected = [
        mock.call(pathlib.Path(self.test_subdirectory, f), mock.ANY)
        for f in files
    ]
    mock_writer.assert_has_calls(expected, any_order=True)

  @mock.patch.object(aclgen, '_WriteFile', autospec=True)
  def test_generate_single_policy(self, mock_writer):
    policy_file = os.path.join(self.test_subdirectory,
                               'policies/pol/sample_cisco_lab.pol')

    aclgen.Run(