def test_IdentityServiceContext_no_data(self, mock_format_ipv6_addr): self.relation_ids.return_value = ['foo'] self.related_units.return_value = ['bar'] self.relation_get.side_effect = self.test_relation.get self.context_complete.return_value = False self.assertEqual(horizon_contexts.IdentityServiceContext()(), {})
def test_IdentityServiceContext_multi_region(self, mock_format_ipv6_addr): mock_format_ipv6_addr.return_value = "foo" self.relation_ids.return_value = ['foo'] self.related_units.return_value = ['bar', 'baz'] self.relation_get.side_effect = self.test_relation.get self.test_relation.set({ 'service_host': 'foo', 'service_port': 5000, 'region': 'regionOne regionTwo' }) self.context_complete.return_value = True self.assertEqual( horizon_contexts.IdentityServiceContext()(), { 'service_host': 'foo', 'service_port': 5000, 'service_protocol': 'http', 'api_version': '2', 'regions': [{ 'endpoint': 'http://foo:5000/v2.0', 'title': 'regionOne' }, { 'endpoint': 'http://foo:5000/v2.0', 'title': 'regionTwo' }] })
def test_IdentityServiceContext_data(self, mock_format_ipv6_addr): mock_format_ipv6_addr.return_value = "foo" self.relation_ids.return_value = ['foo'] self.related_units.return_value = ['bar', 'baz'] self.relation_get.side_effect = self.test_relation.get self.test_relation.set({'service_host': 'foo', 'service_port': 5000}) self.context_complete.return_value = True self.assertEqual(horizon_contexts.IdentityServiceContext()(), {'service_host': 'foo', 'service_port': 5000, 'api_version': '2', 'service_protocol': 'http'})
def test_IdentityServiceContext_api3_missing(self, mock_format_ipv6_addr): mock_format_ipv6_addr.return_value = "foo" self.relation_ids.return_value = ['foo'] self.related_units.return_value = ['bar', 'baz'] self.relation_get.side_effect = self.test_relation.get self.test_relation.set({ 'service_host': 'foo', 'service_port': 5000, 'region': 'regionOne', 'api_version': '3'}) self.context_complete.return_value = False self.assertEqual(horizon_contexts.IdentityServiceContext()(), {})
APACHE_24_SSL = "%s/sites-available/default-ssl.conf" % (APACHE_CONF_DIR) APACHE_24_DEFAULT = "%s/sites-available/000-default.conf" % (APACHE_CONF_DIR) APACHE_SSL = "%s/sites-available/default-ssl" % (APACHE_CONF_DIR) APACHE_DEFAULT = "%s/sites-available/default" % (APACHE_CONF_DIR) INSTALL_DIR = "/usr/share/openstack-dashboard" ROUTER_SETTING = ('/usr/share/openstack-dashboard/openstack_dashboard/enabled/' '_40_router.py') KEYSTONEV3_POLICY = ('/usr/share/openstack-dashboard/openstack_dashboard/conf/' 'keystonev3_policy.json') TEMPLATES = 'templates' CONFIG_FILES = OrderedDict([ (LOCAL_SETTINGS, { 'hook_contexts': [ horizon_contexts.HorizonContext(), horizon_contexts.IdentityServiceContext(), context.SyslogContext(), horizon_contexts.LocalSettingsContext() ], 'services': ['apache2', 'memcached'] }), (APACHE_CONF, { 'hook_contexts': [horizon_contexts.HorizonContext(), context.SyslogContext()], 'services': ['apache2', 'memcached'], }), (APACHE_24_CONF, { 'hook_contexts': [horizon_contexts.HorizonContext(), context.SyslogContext()],
def test_IdentityServiceContext_invalid_endpoint_type(self): self.test_config.set('endpoint-type', 'this_is_bad') with self.assertRaises(Exception): horizon_contexts.IdentityServiceContext()()
def test_IdentityServiceContext_multi_endpoint_types(self): self.test_config.set('endpoint-type', 'internalURL,publicURL') self.assertEqual(horizon_contexts.IdentityServiceContext()(), {'primary_endpoint': 'internalURL', 'secondary_endpoint': 'publicURL'})
def test_IdentityServiceContext_no_units(self): self.relation_ids.return_value = ['foo'] self.related_units.return_value = [] self.context_complete.return_value = False self.assertEqual(horizon_contexts.IdentityServiceContext()(), {})
% (APACHE_CONF_DIR) PORTS_CONF = "%s/ports.conf" % (APACHE_CONF_DIR) APACHE_24_SSL = "%s/sites-available/default-ssl.conf" % (APACHE_CONF_DIR) APACHE_24_DEFAULT = "%s/sites-available/000-default.conf" % (APACHE_CONF_DIR) APACHE_SSL = "%s/sites-available/default-ssl" % (APACHE_CONF_DIR) APACHE_DEFAULT = "%s/sites-available/default" % (APACHE_CONF_DIR) INSTALL_DIR = "/usr/share/openstack-dashboard" ROUTER_SETTING = \ "/usr/share/openstack-dashboard/openstack_dashboard/enabled/_40_router.py" TEMPLATES = 'templates' CONFIG_FILES = OrderedDict([ (LOCAL_SETTINGS, { 'hook_contexts': [horizon_contexts.HorizonContext(), horizon_contexts.IdentityServiceContext(), context.SyslogContext(), horizon_contexts.LocalSettingsContext()], 'services': ['apache2'] }), (APACHE_CONF, { 'hook_contexts': [horizon_contexts.HorizonContext(), context.SyslogContext()], 'services': ['apache2'], }), (APACHE_24_CONF, { 'hook_contexts': [horizon_contexts.HorizonContext(), context.SyslogContext()], 'services': ['apache2'], }), (APACHE_SSL, {