summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/config/tests/test_leapsettings.py5
-rw-r--r--src/leap/bitmask/config/tests/test_providerconfig.py12
-rw-r--r--src/leap/bitmask/services/eip/tests/test_eipconfig.py12
3 files changed, 12 insertions, 17 deletions
diff --git a/src/leap/bitmask/config/tests/test_leapsettings.py b/src/leap/bitmask/config/tests/test_leapsettings.py
index 18166923..b45abfdd 100644
--- a/src/leap/bitmask/config/tests/test_leapsettings.py
+++ b/src/leap/bitmask/config/tests/test_leapsettings.py
@@ -29,6 +29,7 @@ import mock
from leap.common.testing.basetest import BaseLeapTest
from leap.bitmask.config.leapsettings import LeapSettings
+from leap.bitmask.config import flags
class LeapSettingsTest(BaseLeapTest):
@@ -44,6 +45,7 @@ class LeapSettingsTest(BaseLeapTest):
"""
Test that the config file IS NOT stored under the CWD.
"""
+ flags.STANDALONE = False
self._leapsettings = LeapSettings()
with mock.patch('os.listdir') as os_listdir:
# use this method only to spy where LeapSettings is looking for
@@ -57,7 +59,8 @@ class LeapSettingsTest(BaseLeapTest):
"""
Test that the config file IS stored under the CWD.
"""
- self._leapsettings = LeapSettings(standalone=True)
+ flags.STANDALONE = True
+ self._leapsettings = LeapSettings()
with mock.patch('os.listdir') as os_listdir:
# use this method only to spy where LeapSettings is looking for
self._leapsettings.get_configured_providers()
diff --git a/src/leap/bitmask/config/tests/test_providerconfig.py b/src/leap/bitmask/config/tests/test_providerconfig.py
index 7661a1ce..fe27e683 100644
--- a/src/leap/bitmask/config/tests/test_providerconfig.py
+++ b/src/leap/bitmask/config/tests/test_providerconfig.py
@@ -175,10 +175,9 @@ class ProviderConfigTest(BaseLeapTest):
def test_get_ca_cert_path_as_expected(self):
pc = self._provider_config
- pc.get_path_prefix = Mock(return_value='test')
provider_domain = sample_config['domain']
- expected_path = os.path.join('test', 'leap', 'providers',
+ expected_path = os.path.join('leap', 'providers',
provider_domain, 'keys', 'ca',
'cacert.pem')
@@ -186,24 +185,21 @@ class ProviderConfigTest(BaseLeapTest):
os.path.exists = Mock(return_value=True)
cert_path = pc.get_ca_cert_path()
- self.assertEqual(cert_path, expected_path)
+ self.assertTrue(cert_path.endswith(expected_path))
def test_get_ca_cert_path_about_to_download(self):
pc = self._provider_config
- pc.get_path_prefix = Mock(return_value='test')
provider_domain = sample_config['domain']
- expected_path = os.path.join('test', 'leap', 'providers',
+ expected_path = os.path.join('leap', 'providers',
provider_domain, 'keys', 'ca',
'cacert.pem')
cert_path = pc.get_ca_cert_path(about_to_download=True)
-
- self.assertEqual(cert_path, expected_path)
+ self.assertTrue(cert_path.endswith(expected_path))
def test_get_ca_cert_path_fails(self):
pc = self._provider_config
- pc.get_path_prefix = Mock(return_value='test')
# mock 'get_domain' so we don't need to load a config
provider_domain = 'test.provider.com'
diff --git a/src/leap/bitmask/services/eip/tests/test_eipconfig.py b/src/leap/bitmask/services/eip/tests/test_eipconfig.py
index 76305e83..4e340f4c 100644
--- a/src/leap/bitmask/services/eip/tests/test_eipconfig.py
+++ b/src/leap/bitmask/services/eip/tests/test_eipconfig.py
@@ -262,15 +262,13 @@ class EIPConfigTest(BaseLeapTest):
def test_get_client_cert_path_as_expected(self):
config = self._get_eipconfig()
- config.get_path_prefix = Mock(return_value='test')
-
provider_config = ProviderConfig()
# mock 'get_domain' so we don't need to load a config
provider_domain = 'test.provider.com'
provider_config.get_domain = Mock(return_value=provider_domain)
- expected_path = os.path.join('test', 'leap', 'providers',
+ expected_path = os.path.join('leap', 'providers',
provider_domain, 'keys', 'client',
'openvpn.pem')
@@ -278,26 +276,24 @@ class EIPConfigTest(BaseLeapTest):
os.path.exists = Mock(return_value=True)
cert_path = config.get_client_cert_path(provider_config)
- self.assertEqual(cert_path, expected_path)
+ self.assertTrue(cert_path.endswith(expected_path))
def test_get_client_cert_path_about_to_download(self):
config = self._get_eipconfig()
- config.get_path_prefix = Mock(return_value='test')
-
provider_config = ProviderConfig()
# mock 'get_domain' so we don't need to load a config
provider_domain = 'test.provider.com'
provider_config.get_domain = Mock(return_value=provider_domain)
- expected_path = os.path.join('test', 'leap', 'providers',
+ expected_path = os.path.join('leap', 'providers',
provider_domain, 'keys', 'client',
'openvpn.pem')
cert_path = config.get_client_cert_path(
provider_config, about_to_download=True)
- self.assertEqual(cert_path, expected_path)
+ self.assertTrue(cert_path.endswith(expected_path))
def test_get_client_cert_path_fails(self):
config = self._get_eipconfig()