Ejemplo n.º 1
0
    def test_file_executable(self):
        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        fp = t.get_split_tunnel_script_fp()
        isfile = os.path.isfile(fp)
        self.assertTrue(isfile and os.access(fp, os.X_OK))
Ejemplo n.º 2
0
    def test_file_executable(self):
        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        fp = t.get_split_tunnel_script_fp()
        isfile = os.path.isfile(fp)
        self.assertTrue(isfile and os.access(fp, os.X_OK))
Ejemplo n.º 3
0
    def test_single_ip_contents(self):
        self.cp.set(self.sec, 'ips', '192.168.3.50')

        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        contents = t._tun_script
        self.assertEqual(contents.count('add_ip 192.168.3.50'), 1)
Ejemplo n.º 4
0
    def test_single_ip_contents(self):
        self.cp.set(self.sec, 'ips', '192.168.3.50')

        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        contents = t._tun_script
        self.assertEqual(contents.count('add_ip 192.168.3.50'), 1)
Ejemplo n.º 5
0
class TestDefaultTunnelConf(unittest.TestCase):
    def setUp(self):
        self.t = VpncTunnel(conf_file=None)

    def test_cmd_builder(self):
        """
        Test that ``VpncTunnel._build_cmd`` builds the proper command.
        """
        test_conf = '/tmp/test'
        expected_cmd = ['calabar_vpnc', test_conf]

        cmd = self.t._build_cmd(test_conf, None)
        self.assertTrue(cmd, expected_cmd)

    def test_executable(self):
        self.assertEqual(self.t.executable, '/usr/sbin/vpnc')
Ejemplo n.º 6
0
class TestDefaultTunnelConf(unittest.TestCase):
    def setUp(self):
        self.t = VpncTunnel(conf_file=None)

    def test_cmd_builder(self):
        """
        Test that ``VpncTunnel._build_cmd`` builds the proper command.
        """
        test_conf = '/tmp/test'
        expected_cmd = ['calabar_vpnc', test_conf]

        cmd = self.t._build_cmd(test_conf, None)
        self.assertTrue(cmd, expected_cmd)

    def test_executable(self):
        self.assertEqual(self.t.executable, '/usr/sbin/vpnc')
Ejemplo n.º 7
0
 def setUp(self):
     self.t = VpncTunnel(conf_file=None)
Ejemplo n.º 8
0
    def test_file_exists(self):
        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        os.path.isfile(t.get_split_tunnel_script_fp())
Ejemplo n.º 9
0
    def test_no_ip_contents(self):
        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        contents = t._tun_script
        self.assertEqual(contents.count('add_ip'), 1)
Ejemplo n.º 10
0
    def test_multiple_ip_parsing(self):
        self.cp.set(self.sec, 'ips', '192.168.3.50, 192.168.3.51')

        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        self.assertEqual(tun_conf_d['ips'], ['192.168.3.50', '192.168.3.51'])
Ejemplo n.º 11
0
 def test_single_ip_parsing(self):
     tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
     self.assertEqual(tun_conf_d['ips'], ['192.168.3.50'])
Ejemplo n.º 12
0
    def test_file_exists(self):
        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        os.path.isfile(t.get_split_tunnel_script_fp())
Ejemplo n.º 13
0
 def setUp(self):
     self.t = VpncTunnel(conf_file=None)
Ejemplo n.º 14
0
    def test_no_ip_contents(self):
        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        t = VpncTunnel(**tun_conf_d)

        contents = t._tun_script
        self.assertEqual(contents.count('add_ip'), 1)
Ejemplo n.º 15
0
    def test_multiple_ip_parsing(self):
        self.cp.set(self.sec, 'ips', '192.168.3.50, 192.168.3.51')

        tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
        self.assertEqual(tun_conf_d['ips'], ['192.168.3.50', '192.168.3.51'])
Ejemplo n.º 16
0
 def test_single_ip_parsing(self):
     tun_conf_d = VpncTunnel.parse_configuration(self.cp, self.sec)
     self.assertEqual(tun_conf_d['ips'], ['192.168.3.50'])