diff --git a/hobo/agent/common/management/commands/hobo_deploy.py b/hobo/agent/common/management/commands/hobo_deploy.py index ab43ec2..0d250f1 100644 --- a/hobo/agent/common/management/commands/hobo_deploy.py +++ b/hobo/agent/common/management/commands/hobo_deploy.py @@ -93,13 +93,14 @@ class Command(BaseCommand): if not self.me.get('secondary'): replace_file(tenant_hobo_json, json.dumps(hobo_environment, indent=2)) + self.configure_template(hobo_environment, tenant) + def deploy_specifics(self, hobo_environment, tenant): # configure things that are quite common but may actually not be # common to *all* tenants. self.generate_saml_keys(tenant, prefix='sp-') self.configure_service_provider(hobo_environment, tenant) self.configure_theme(hobo_environment, tenant) - self.configure_template(hobo_environment, tenant) def generate_saml_keys(self, tenant, prefix=''): diff --git a/tests/test_hobo_deploy.py b/tests/test_hobo_deploy.py index 00be16c..8761415 100644 --- a/tests/test_hobo_deploy.py +++ b/tests/test_hobo_deploy.py @@ -162,6 +162,7 @@ def test_deploy(mocked_get_tenant_by_hostname, tmpdir): command.deploy_specifics = Mock() tenant = Mock() tenant.get_directory = Mock(return_value=str(tmpdir)) + command.configure_template = Mock() base_url = 'https://combo.dev.publik.love/' tenant_hobo_json = os.path.join(str(tmpdir), 'hobo.json') ENVIRONMENT = {'services': [{'service-id': 'combo', 'base_url': base_url}], @@ -179,6 +180,8 @@ def test_deploy(mocked_get_tenant_by_hostname, tmpdir): content = json.load(handler) assert ENVIRONMENT['services'][0]['this'] is True # new entry added assert json.dumps(content, sort_keys=True), json.dumps(ENVIRONMENT, sort_keys=True) + assert command.configure_template.mock_calls == [call(ENVIRONMENT, tenant)] + command.configure_template.reset_mock() # create tenant first command.deploy_specifics.reset_mock() @@ -218,13 +221,11 @@ def test_deploy_specific(): command.generate_saml_keys = Mock() command.configure_service_provider = Mock() command.configure_theme = Mock() - command.configure_template = Mock() command.deploy_specifics('my_hobo_env', 'my_tenant') assert command.generate_saml_keys.mock_calls == [call('my_tenant', prefix='sp-')] assert command.configure_service_provider.mock_calls == [call('my_hobo_env', 'my_tenant')] assert command.configure_theme.mock_calls == [call('my_hobo_env', 'my_tenant')] - assert command.configure_template.mock_calls == [call('my_hobo_env', 'my_tenant')] def test_generate_saml_keys(tmpdir):