diff options
author | kali <kali@leap.se> | 2012-09-25 07:19:07 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-09-25 07:19:07 +0900 |
commit | 5d8e518d03e9fd045a75a63fec79b52392266c26 (patch) | |
tree | f69d91d4d7d316f1d38c479e7ae43895b94bb2e9 /src/leap/base/tests/test_providers.py | |
parent | 30570bd89c04a56b35b91a0bc1d5fc00bb6ad266 (diff) |
make test for provider pass
Diffstat (limited to 'src/leap/base/tests/test_providers.py')
-rw-r--r-- | src/leap/base/tests/test_providers.py | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/leap/base/tests/test_providers.py b/src/leap/base/tests/test_providers.py index 9e0ff90c..d667a7e0 100644 --- a/src/leap/base/tests/test_providers.py +++ b/src/leap/base/tests/test_providers.py @@ -4,6 +4,10 @@ try: except ImportError: import unittest +# XXX FIXME +import logging +logging.basicConfig() + import os from leap import __branding as BRANDING @@ -12,24 +16,25 @@ from leap.base import providers EXPECTED_DEFAULT_CONFIG = { - "api_version": "0.1.0", - "description": "test provider", - "display_name": "test provider", - "domain": "testprovider.example.org", - "enrollment_policy": "open", - "serial": 1, - "services": [ - "eip" + u"api_version": u"0.1.0", + u"description": {u'en': u"Test provider"}, + u"display_name": {u'en': u"Test Provider"}, + u"domain": u"testprovider.example.org", + u"enrollment_policy": u"open", + u"serial": 1, + u"services": [ + u"eip" ], - "version": "0.1.0" + u"version": u"0.1.0" } class TestLeapProviderDefinition(BaseLeapTest): def setUp(self): self.definition = providers.LeapProviderDefinition() - #XXX change to self.definition.config when property is fixed - self.config = self.definition.get_config() + self.definition.save() + self.definition.load() + self.config = self.definition.config def tearDown(self): if hasattr(self, 'testfile') and os.path.isfile(self.testfile): @@ -57,6 +62,7 @@ class TestLeapProviderDefinition(BaseLeapTest): self.testfile = self.get_tempfile('test.json') self.definition.save(to=self.testfile) deserialized = json.load(open(self.testfile, 'rb')) + self.maxDiff = None self.assertEqual(deserialized, EXPECTED_DEFAULT_CONFIG) def test_provider_dump_to_slug(self): @@ -88,17 +94,8 @@ class TestLeapProviderDefinition(BaseLeapTest): # type cast raise NotImplementedError - -class TestLeapProvider(BaseLeapTest): - def setUp(self): - pass - - def tearDown(self): - pass - - ### - - # XXX ?? + def test_provider_validation(self): + self.definition.jsonvalidate(self.config) class TestLeapProviderSet(BaseLeapTest): |