Switch the license validator to use config_provider and have a test license

Fixes the broken tests currently which try (and fail) to read the license file
This commit is contained in:
Joseph Schorr 2016-10-18 11:44:13 -04:00
parent 2a7dbd3348
commit 67f828279d
4 changed files with 23 additions and 9 deletions

View file

@ -5,6 +5,18 @@ from util.config.provider.baseprovider import BaseProvider
REAL_FILES = ['test/data/signing-private.gpg', 'test/data/signing-public.gpg']
class TestLicense(object):
@property
def subscription(self):
return {}
@property
def is_expired(self):
return False
def validate(self, config):
pass
class TestConfigProvider(BaseProvider):
""" Implementation of the config provider for testing. Everything is kept in-memory instead on
the real file system. """
@ -58,6 +70,9 @@ class TestConfigProvider(BaseProvider):
def requires_restart(self, app_config):
return False
def get_license(self):
return TestLicense()
def reset_for_test(self):
self._config['SUPER_USERS'] = ['devtable']
self.files = {}