Change Signer to use the config provider and fix tests

Fixes the broken ACI tests
This commit is contained in:
Joseph Schorr 2016-05-23 17:10:03 -04:00
parent 5568cc77b8
commit f670c4c7a9
5 changed files with 23 additions and 16 deletions

View file

@ -3,6 +3,8 @@ from StringIO import StringIO
from util.config.provider.baseprovider import BaseProvider
REAL_FILES = ['test/data/signing-private.gpg', 'test/data/signing-public.gpg']
class TestConfigProvider(BaseProvider):
""" Implementation of the config provider for testing. Everything is kept in-memory instead on
the real file system. """
@ -36,12 +38,18 @@ class TestConfigProvider(BaseProvider):
return True
def volume_file_exists(self, filename):
if filename in REAL_FILES:
return True
return filename in self.files
def save_volume_file(self, filename, flask_file):
self.files[filename] = ''
def get_volume_file(self, filename, mode='r'):
if filename in REAL_FILES:
return open(filename, mode=mode)
return StringIO(self.files[filename])
def requires_restart(self, app_config):