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', 'default_role': 'member', '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()(), {})
def test_IdentityServiceContext_api3(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', 'admin_domain_id': 'admindomainid' }) self.context_complete.return_value = True self.assertEqual( horizon_contexts.IdentityServiceContext()(), { 'service_host': 'foo', 'service_port': 5000, 'api_version': '3', 'default_role': 'member', 'admin_domain_id': 'admindomainid', 'service_protocol': 'http' })
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_DEFAULT = os.path.join(APACHE_CONF_DIR, "sites-available/default") INSTALL_DIR = "/usr/share/openstack-dashboard" ROUTER_SETTING = os.path.join(DASHBOARD_PKG_DIR, 'enabled/_40_router.py') KEYSTONEV3_POLICY = os.path.join(DASHBOARD_PKG_DIR, 'conf/keystonev3_policy.json') CONSISTENCY_GROUP_POLICY = os.path.join( DASHBOARD_PKG_DIR, 'conf/cinder_policy.d/consistencygroup.yaml') TEMPLATES = 'templates' CUSTOM_THEME_DIR = os.path.join(DASHBOARD_PKG_DIR, "themes/custom") LOCAL_DIR = os.path.join(DASHBOARD_PKG_DIR, 'local/local_settings.d') CONFIG_FILES = OrderedDict([ (LOCAL_SETTINGS, { 'hook_contexts': [ horizon_contexts.HorizonContext(), horizon_contexts.IdentityServiceContext(), context.SyslogContext(), horizon_contexts.LocalSettingsContext(), horizon_contexts.ApacheSSLContext(), horizon_contexts.WebSSOFIDServiceProviderContext(), horizon_contexts.PolicydContext(lambda: read_policyd_dirs()) ], 'services': ['apache2', 'memcached'] }), (APACHE_CONF, { 'hook_contexts': [ horizon_contexts.HorizonContext(), context.SyslogContext(), context.WSGIWorkerConfigContext() ], 'services': ['apache2', 'memcached'],