From 446562e921a846445449edb3321c4d8133698fbb Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 24 Aug 2017 16:43:03 -0400 Subject: [tests] fix path for data files --- tests/unit/vpn/test_management.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/vpn/test_management.py b/tests/unit/vpn/test_management.py index 4066ab6..2bcb0b9 100644 --- a/tests/unit/vpn/test_management.py +++ b/tests/unit/vpn/test_management.py @@ -19,14 +19,20 @@ Tests for the VPN Management Interface """ +import os import StringIO from twisted.trial import unittest from leap.bitmask.vpn.management import ManagementProtocol -session1 = open('session1.data').readlines() -session2 = open('session2.data').readlines() +def get_data(name): + return os.path.join( + os.path.abspath(os.path.split(__file__)[0]), '%s.data' % name) + + +session1 = open(get_data('session1')).readlines() +session2 = open(get_data('session2')).readlines() def feed_the_protocol(protocol, data): @@ -92,7 +98,7 @@ class ManagementTestCase(unittest.TestCase): def test_get_pid(self): proto = ManagementProtocol() proto.transport = StringIO.StringIO() - assert proto.pid == None + assert proto.pid is None proto.getPid() pid_lines = ['SUCCESS: pid=99999'] feed_the_protocol(proto, pid_lines) @@ -126,4 +132,4 @@ class ManagementTestCase(unittest.TestCase): assert info['state_simple'] == 'ON' assert info['state_legend'] == 'Initialization Sequence Completed' assert info['openvpn_version'].startswith('OpenVPN 2.4.0') - assert info['pid'] == 23783 + assert info['pid'] == 23783 -- cgit v1.2.3