def test_cluster_changed(self, configs, mock_log, mock_config, mock_relation_ids, mock_update_all_identity_relation_units): relation_settings = { 'foo_passwd': '123', 'identity-service:16_foo': 'bar' } mock_relation_ids.return_value = [] self.is_leader.return_value = False def fake_rel_get(attribute=None, *args, **kwargs): if not attribute: return relation_settings return relation_settings.get(attribute) self.relation_get.side_effect = fake_rel_get mock_config.return_value = None hooks.cluster_changed() whitelist = ['_passwd', 'identity-service:'] self.peer_echo.assert_called_with(force=True, includes=whitelist) self.assertTrue(configs.write_all.called)
def test_cluster_changed( self, configs, ssh_authorized_peers, check_peer_actions, mock_synchronize_ca, mock_ensure_ssl_cert_master, mock_log, mock_config, mock_relation_ids, mock_peer_units, mock_is_ssl_cert_master, mock_get_ssl_sync_request_units, mock_update_all_identity_relation_units, mock_initialise_pki): relation_settings = { 'foo_passwd': '123', 'identity-service:16_foo': 'bar' } mock_is_ssl_cert_master.return_value = False mock_peer_units.return_value = ['unit/0'] mock_ensure_ssl_cert_master.return_value = False mock_relation_ids.return_value = [] self.is_elected_leader.return_value = False def fake_rel_get(attribute=None, *args, **kwargs): if not attribute: return relation_settings return relation_settings.get(attribute) self.relation_get.side_effect = fake_rel_get mock_config.return_value = None hooks.cluster_changed() whitelist = [ '_passwd', 'identity-service:', 'ssl-cert-master', 'db-initialised', 'ssl-cert-available-updates' ] self.peer_echo.assert_called_with(force=True, includes=whitelist) ssh_authorized_peers.assert_called_with(user=self.ssh_user, group='juju_keystone', peer_interface='cluster', ensure_local_user=True) self.assertFalse(mock_synchronize_ca.called) self.assertTrue(configs.write_all.called)
def test_cluster_changed(self, configs, ssh_authorized_peers, check_peer_actions, mock_synchronize_ca, mock_ensure_ssl_cert_master, mock_log, mock_config, mock_relation_ids, mock_peer_units, mock_is_ssl_cert_master, mock_get_ssl_sync_request_units, mock_update_all_identity_relation_units, mock_initialise_pki): relation_settings = {'foo_passwd': '123', 'identity-service:16_foo': 'bar'} mock_is_ssl_cert_master.return_value = False mock_peer_units.return_value = ['unit/0'] mock_ensure_ssl_cert_master.return_value = False mock_relation_ids.return_value = [] self.is_elected_leader.return_value = False def fake_rel_get(attribute=None, *args, **kwargs): if not attribute: return relation_settings return relation_settings.get(attribute) self.relation_get.side_effect = fake_rel_get mock_config.return_value = None hooks.cluster_changed() whitelist = ['_passwd', 'identity-service:', 'ssl-cert-master', 'db-initialised', 'ssl-cert-available-updates'] self.peer_echo.assert_called_with(force=True, includes=whitelist) ssh_authorized_peers.assert_called_with( user=self.ssh_user, group='juju_keystone', peer_interface='cluster', ensure_local_user=True) self.assertFalse(mock_synchronize_ca.called) self.assertTrue(configs.write_all.called)
def test_cluster_changed(self, configs, mock_log, mock_config, mock_relation_ids, mock_update_all_identity_relation_units): relation_settings = {'foo_passwd': '123', 'identity-service:16_foo': 'bar'} mock_relation_ids.return_value = [] self.is_leader.return_value = False def fake_rel_get(attribute=None, *args, **kwargs): if not attribute: return relation_settings return relation_settings.get(attribute) self.relation_get.side_effect = fake_rel_get mock_config.return_value = None hooks.cluster_changed() whitelist = ['_passwd', 'identity-service:'] self.peer_echo.assert_called_with(force=True, includes=whitelist) self.assertTrue(configs.write_all.called)