# Path: neutron_vpnaas/services/vpn/common/netns_wrapper.py
# LOG = logging.getLogger(__name__)
# def setup_conf():
# def execute(cmd):
# def filter_command(command, rootwrap_config):
# def execute_with_mount():
# def main():


from unittest import mock
from neutron.tests import base
from neutron_vpnaas.services.vpn.common import netns_wrapper as nswrap
#    under the License.




class TestNetnsWrapper(base.BaseTestCase):

    def setUp(self):
        super(TestNetnsWrapper, self).setUp()
        patch_methods = ['filter_command',
                         'execute',
                         'setup_conf']
        for method in patch_methods:
            self.patch_obj(nswrap, method)
        patch_classes = ['neutron.common.config.setup_logging',
                         'os.path.isdir',
                         'os.path.samefile',
                         'sys.exit']
        for cls in patch_classes:
            self.patch_cls(cls)

        self.filter_command.return_value = False
        self.execute.return_value = 0
        self.conf = mock.Mock()
        self.conf.cmd = 'ls,-al'
        self.conf.mount_paths = {'/foo': '/dir/foo',
                                 '/var': '/dir/var'}
        self.setup_conf.return_value = self.conf
        self.conf.rootwrap_config = 'conf'
        self.isdir.return_value = True

# Path: neutron_vpnaas/services/vpn/common/netns_wrapper.py
# LOG = logging.getLogger(__name__)
# def setup_conf():
# def execute(cmd):
# def filter_command(command, rootwrap_config):
# def execute_with_mount():
# def main():


# Path: neutron_vpnaas/tests/unit/services/vpn/common/test_netns_wrapper.py
from unittest import mock
from neutron.tests import base
from neutron_vpnaas.services.vpn.common import netns_wrapper as nswrap

#    under the License.




class TestNetnsWrapper(base.BaseTestCase):

    def setUp(self):
        super(TestNetnsWrapper, self).setUp()
        patch_methods = ['filter_command',
                         'execute',
                         'setup_conf']
        for method in patch_methods:
            self.patch_obj(nswrap, method)
        patch_classes = ['neutron.common.config.setup_logging',
                         'os.path.isdir',
                         'os.path.samefile',
                         'sys.exit']
        for cls in patch_classes:
            self.patch_cls(cls)

        self.filter_command.return_value = False
        self.execute.return_value = 0
        self.conf = mock.Mock()
        self.conf.cmd = 'ls,-al'
        self.conf.mount_paths = {'/foo': '/dir/foo',
                                 '/var': '/dir/var'}
        self.setup_conf.return_value = self.conf
        self.conf.rootwrap_config = 'conf'
        self.isdir.return_value = True

        self.samefile.return_value = False