server_environment: Improve tests.common to allow redefinition of serv_config application

This commit is contained in:
Akim Juillerat 2020-02-13 11:02:29 +01:00 committed by Maxime Franco
parent b867310279
commit f260cca2b5
1 changed files with 4 additions and 4 deletions

View File

@ -44,13 +44,13 @@ class ServerEnvironmentCase(common.SavepointCase):
yield
@contextmanager
def load_config(self, public=None, secret=None):
original_serv_config = server_env_mixin.serv_config
def load_config(self, public=None, secret=None, serv_config_class=server_env_mixin):
original_serv_config = serv_config_class.serv_config
try:
with self.set_config_dir(None), self.set_env_variables(public, secret):
parser = server_env._load_config()
server_env_mixin.serv_config = parser
serv_config_class.serv_config = parser
yield
finally:
server_env_mixin.serv_config = original_serv_config
serv_config_class.serv_config = original_serv_config