def test_ceilometer_service_context(self): self.relation_ids.return_value = ['ceilometer-service:0'] self.related_units.return_value = ['ceilometer/0'] data = { 'debug': True, 'verbose': False, 'rabbitmq_host': 'foo', 'rabbitmq_user': '******', 'rabbitmq_password': '******', 'rabbitmq_virtual_host': 'openstack', 'rabbit_ssl_ca': None, 'rabbit_ssl_port': None, 'api_version': 3, 'auth_protocol': 'http', 'auth_host': 'keystone', 'auth_port': '80', 'service_protocol': 'http', 'service_host': 'keystone', 'service_port': '80', 'signing_dir': '/var/lib/ceilometer', 'admin_domain_name': 'admin_domain', 'admin_tenant_name': 'admin', 'admin_user': '******', 'admin_password': '******', 'metering_secret': 'secret' } self.test_relation.set(data) self.assertEquals(contexts.CeilometerServiceContext()(), data)
def test_ceilometer_service_context_not_related(self): self.relation_ids.return_value = [] self.assertEqual(contexts.CeilometerServiceContext()(), {})
def test_ceilometer_service_context(self): self.relation_ids.return_value = ['ceilometer-service:0'] self.related_units.return_value = ['ceilometer/0'] data = {'metering_secret': 'mysecret', 'keystone_host': 'test'} self.test_relation.set(data) self.assertEqual(contexts.CeilometerServiceContext()(), data)