def test_tune_pki_backend_config_changed_paused( self, vault_pki, _client_approle_authorized): _client_approle_authorized.return_value = True self.is_unit_paused_set.return_value = True handlers.tune_pki_backend_config_changed() assert not vault_pki.tune_pki_backend.called assert not vault_pki.update_roles.called
def test_tune_pki_backend_config_changed_notrunning(self, vault_pki): self.is_unit_paused_set.return_value = False self.service_running.return_value = False handlers.tune_pki_backend_config_changed() self.set_flag.assert_called_with('failed.to.start') assert not vault_pki.tune_pki_backend.called assert not vault_pki.update_roles.called
def test_tune_pki_backend_config_changed_sealed(self, vault_pki, _vault): self.is_unit_paused_set.return_value = False self._set_sealed(_vault, True) self.config.return_value = { 'default-ttl': '8759h', 'max-ttl': '87600h', } handlers.tune_pki_backend_config_changed() assert not vault_pki.tune_pki_backend.called assert not vault_pki.update_roles.called
def test_tune_pki_backend_config_changed(self, vault_pki, _vault): self.is_unit_paused_set.return_value = False self._set_sealed(_vault, False) self.config.return_value = { 'default-ttl': '8759h', 'max-ttl': '87600h', } handlers.tune_pki_backend_config_changed() vault_pki.tune_pki_backend.assert_called_once_with(max_ttl='87600h', ttl='8759h') vault_pki.update_roles.assert_called_once_with(max_ttl='87600h')
def test_tune_pki_backend_config_changed_paused(self, vault_pki): self.is_unit_paused_set.return_value = True handlers.tune_pki_backend_config_changed() assert not vault_pki.tune_pki_backend.called assert not vault_pki.update_roles.called