hobo_deploy: write hobo.json even if import_template fails (#33874)
This commit is contained in:
parent
e869920a9d
commit
e1c34b3b63
|
@ -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=''):
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue