def test_keystone_changed_image_service_joined(self, configs, imgsj, osj, https): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['identity-service'] rids = ['nova-cloud-controller:1', 'nova-compute:1'] self.relation_ids.return_value = rids relations.keystone_changed() [self.assertIn(call(r), imgsj.call_args_list) for r in rids]
def test_keystone_changed_no_object_store_relation(self, configs, configure_https): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['identity-service'] configs.write = MagicMock() self.relation_ids.return_value = [] relations.keystone_changed() self.assertEquals([call('/etc/glance/glance-api.conf'), call('/etc/glance/glance-registry.conf')], configs.write.call_args_list) self.assertTrue(configure_https.called)
def test_keystone_changed_no_object_store_relation(self, configs, configure_https): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['identity-service'] configs.write = MagicMock() self.relation_ids.return_value = [] relations.keystone_changed() self.assertEqual([ call('/etc/glance/glance-api.conf'), call('/etc/glance/glance-registry.conf') ], configs.write.call_args_list) self.assertTrue(configure_https.called)
def test_keystone_changed_with_object_store_relation(self, git_requested, configs, object_store_joined, configure_https): git_requested.return_value = False configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['identity-service'] configs.write = MagicMock() self.relation_ids.return_value = ['object-store:0'] relations.keystone_changed() self.assertEquals([call('/etc/glance/glance-api.conf'), call('/etc/glance/glance-registry.conf')], configs.write.call_args_list) object_store_joined.assert_called_with() self.assertTrue(configure_https.called)
def test_keystone_changed_with_object_store_relation( self, configs, object_store_joined, configure_https, image_service_joined): configs.complete_contexts = MagicMock() configs.complete_contexts.return_value = ['identity-service'] configs.write = MagicMock() self.relation_ids.side_effect = [ ['object-store:0'], ['image-service:0'], ] relations.keystone_changed() self.assertEqual([ call('/etc/glance/glance-api.conf'), call('/etc/glance/glance-registry.conf') ], configs.write.call_args_list) object_store_joined.assert_called_with() self.assertTrue(configure_https.called) image_service_joined.assert_called_with('image-service:0')
def test_keystone_changes_incomplete(self, configs): configs.complete_contexts.return_value = [] relations.keystone_changed() self.assertTrue(self.juju_log.called) self.assertFalse(configs.write.called)