diff options
author | Kali Kaneko <kali@leap.se> | 2017-08-24 16:43:03 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-08-30 16:18:11 -0400 |
commit | 446562e921a846445449edb3321c4d8133698fbb (patch) | |
tree | 62f2f276cff950b9791d073792de5862acbfb628 /tests/unit | |
parent | ec2592773d6f36194075ef45ce75fd129b05e155 (diff) |
[tests] fix path for data files
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/vpn/test_management.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/unit/vpn/test_management.py b/tests/unit/vpn/test_management.py index 4066ab61..2bcb0b92 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 |