diff options
author | kali <kali@leap.se> | 2012-12-20 02:50:52 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-12-20 02:50:52 +0900 |
commit | e98c3cc5fad75bea038dc67238e5ce85d701b1e1 (patch) | |
tree | 343b641ac81a5578cac25628748b0690708d2aa7 /src/leap | |
parent | 6a8b5c24571251cb39e8d83333b0450e8324dcbe (diff) |
fix broken tests
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/base/constants.py | 33 | ||||
-rw-r--r-- | src/leap/base/tests/test_providers.py | 3 | ||||
-rw-r--r-- | src/leap/crypto/tests/test_certs.py | 15 | ||||
-rw-r--r-- | src/leap/eip/checks.py | 4 |
4 files changed, 38 insertions, 17 deletions
diff --git a/src/leap/base/constants.py b/src/leap/base/constants.py index f7be8d98..b38723be 100644 --- a/src/leap/base/constants.py +++ b/src/leap/base/constants.py @@ -14,18 +14,27 @@ DEFAULT_PROVIDER = __branding.get( DEFINITION_EXPECTED_PATH = "provider.json" DEFAULT_PROVIDER_DEFINITION = { - u'api_uri': u'https://api.%s/' % DEFAULT_PROVIDER, - u'api_version': u'0.1.0', - u'ca_cert_fingerprint': u'8aab80ae4326fd30721689db813733783fe0bd7e', - u'ca_cert_uri': u'https://%s/cacert.pem' % DEFAULT_PROVIDER, - u'description': {u'en': u'This is a test provider'}, - u'display_name': {u'en': u'Test Provider'}, - u'domain': u'%s' % DEFAULT_PROVIDER, - u'enrollment_policy': u'open', - u'public_key': u'cb7dbd679f911e85bc2e51bd44afd7308ee19c21', - u'serial': 1, - u'services': [u'eip'], - u'version': u'0.1.0'} + u"api_uri": "https://api.%s/" % DEFAULT_PROVIDER, + u"api_version": u"1", + u"ca_cert_fingerprint": "SHA256: fff", + u"ca_cert_uri": u"https://%s/ca.crt" % DEFAULT_PROVIDER, + u"default_language": u"en", + u"description": { + u"en": u"A demonstration service provider using the LEAP platform" + }, + u"domain": "%s" % DEFAULT_PROVIDER, + u"enrollment_policy": u"open", + u"languages": [ + u"en" + ], + u"name": { + u"en": u"Test Provider" + }, + u"services": [ + "openvpn" + ] +} + MAX_ICMP_PACKET_LOSS = 10 diff --git a/src/leap/base/tests/test_providers.py b/src/leap/base/tests/test_providers.py index 8801a3eb..9c11f270 100644 --- a/src/leap/base/tests/test_providers.py +++ b/src/leap/base/tests/test_providers.py @@ -90,7 +90,8 @@ class TestLeapProviderDefinition(BaseLeapTest): def test_provider_validation(self): self.definition.validate(self.config) _config = copy.deepcopy(self.config) - _config['serial'] = 'aaa' + # bad type, raise validation error + _config['domain'] = 111 with self.assertRaises(jsonschema.ValidationError): self.definition.validate(_config) diff --git a/src/leap/crypto/tests/test_certs.py b/src/leap/crypto/tests/test_certs.py index 4d167c51..e476b630 100644 --- a/src/leap/crypto/tests/test_certs.py +++ b/src/leap/crypto/tests/test_certs.py @@ -1,10 +1,21 @@ import unittest +from leap.testing.https_server import where +from leap.crypto import certs + class CertTestCase(unittest.TestCase): - def test_load_client_and_pkey(self): - self.fail('not implemented') + def test_can_load_client_and_pkey(self): + with open(where('leaptestscert.pem')) as cf: + cs = cf.read() + with open(where('leaptestskey.pem')) as kf: + ks = kf.read() + certs.can_load_cert_and_pkey(cs + ks) + + with self.assertRaises(certs.BadCertError): + # screw header + certs.can_load_cert_and_pkey(cs.replace("BEGIN", "BEGINN") + ks) if __name__ == "__main__": diff --git a/src/leap/eip/checks.py b/src/leap/eip/checks.py index 65596d1c..9ae6e5f5 100644 --- a/src/leap/eip/checks.py +++ b/src/leap/eip/checks.py @@ -278,8 +278,8 @@ class ProviderCertChecker(object): to_ = time.gmtime(cert.expiration_time) # FIXME BUG ON LEAP_CLI, certs are not valid on gmtime # See #1153 - #return from_ < now() < to_ - return now() < to_ + return from_ < now() < to_ + #return now() < to_ def is_valid_pemfile(self, cert_s=None): """ |