Пример #1
0
    def setUp(self):
        super(APITestCase, self).setUp()
        utils.patch_middleware_get_user()

        def fake_keystoneclient(request, admin=False):
            """
            Wrapper function which returns the stub keystoneclient. Only
            necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_keystoneclient()

        # Store the original clients
        self._original_glanceclient = api.glance.glanceclient
        self._original_keystoneclient = api.keystone.keystoneclient
        self._original_novaclient = api.nova.novaclient
        self._original_neutronclient = api.neutron.neutronclient
        self._original_cinderclient = api.cinder.cinderclient
        self._original_heatclient = api.heat.heatclient
        self._original_ceilometerclient = api.ceilometer.ceilometerclient
        self._original_troveclient = api.trove.troveclient

        # Replace the clients with our stubs.
        api.glance.glanceclient = lambda request: self.stub_glanceclient()
        api.keystone.keystoneclient = fake_keystoneclient
        api.nova.novaclient = lambda request: self.stub_novaclient()
        api.neutron.neutronclient = lambda request: self.stub_neutronclient()
        api.cinder.cinderclient = lambda request: self.stub_cinderclient()
        api.heat.heatclient = lambda request: self.stub_heatclient()
        api.ceilometer.ceilometerclient = lambda request: \
            self.stub_ceilometerclient()
        api.trove.troveclient = lambda request: self.stub_troveclient()
Пример #2
0
    def setUp(self):
        super(TestApi, self).setUp()

        # Usually this monkey patching happens in urls.py. This doesn't work
        # here because we never invoke urls.py in this test. So we have to do
        # it manually.
        utils.patch_middleware_get_user()
Пример #3
0
    def setUp(self):
        super(TestApi, self).setUp()

        # Usually this monkey patching happens in urls.py. This doesn't work
        # here because we never invoke urls.py in this test. So we have to do
        # it manually.
        utils.patch_middleware_get_user()
Пример #4
0
    def setUp(self):
        super(APITestCase, self).setUp()
        utils.patch_middleware_get_user()

        def fake_keystoneclient(request, admin=False):
            """
            Wrapper function which returns the stub keystoneclient. Only
            necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_keystoneclient()

        # Store the original clients
        self._original_glanceclient = api.glance.glanceclient
        self._original_keystoneclient = api.keystone.keystoneclient
        self._original_novaclient = api.nova.novaclient
        self._original_neutronclient = api.neutron.neutronclient
        self._original_cinderclient = api.cinder.cinderclient
        self._original_heatclient = api.heat.heatclient
        self._original_ceilometerclient = api.ceilometer.ceilometerclient
        if with_trove:
            self._original_troveclient = api.trove.troveclient

        # Replace the clients with our stubs.
        api.glance.glanceclient = lambda request: self.stub_glanceclient()
        api.keystone.keystoneclient = fake_keystoneclient
        api.nova.novaclient = lambda request: self.stub_novaclient()
        api.neutron.neutronclient = lambda request: self.stub_neutronclient()
        api.cinder.cinderclient = lambda request: self.stub_cinderclient()
        api.heat.heatclient = lambda request: self.stub_heatclient()
        api.ceilometer.ceilometerclient = lambda request: \
            self.stub_ceilometerclient()
        if with_trove:
            api.trove.troveclient = lambda request: self.stub_troveclient()
Пример #5
0
    def setUp(self):
        super(APITestCase, self).setUp()
        utils.patch_middleware_get_user()

        def fake_keystoneclient(request, admin=False):
            """Wrapper function which returns the stub keystoneclient. Only
            necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_keystoneclient()

        # Store the original clients
        self._original_keystoneclient = api.keystone.keystoneclient

        # Replace the clients with our stubs.
        api.keystone.keystoneclient = fake_keystoneclient
Пример #6
0
    def setUp(self):
        super(APITestCase, self).setUp()
        utils.patch_middleware_get_user()

        def fake_keystoneclient(request, admin=False):
            """Returns the stub keystoneclient.

            Only necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_keystoneclient()

        # Store the original clients
        self._original_keystoneclient = project_api.keystone.keystoneclient
        self._original_heatclient = api.heat.heatclient

        # Replace the clients with our stubs.
        project_api.keystone.keystoneclient = fake_keystoneclient
        api.heat.heatclient = (
            lambda request, password=None: self.stub_heatclient())
Пример #7
0
    def setUp(self):
        super(APITestCase, self).setUp()
        utils.patch_middleware_get_user()

        def fake_keystoneclient(request, admin=False):
            """Returns the stub keystoneclient.

            Only necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_keystoneclient()

        def fake_glanceclient(request, version='1'):
            """Returns the stub glanceclient.

            Only necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_glanceclient()

        def fake_novaclient(request, version=None):
            return self.stub_novaclient()

        # Store the original clients
        self._original_glanceclient = api.glance.glanceclient
        self._original_keystoneclient = api.keystone.keystoneclient
        self._original_novaclient = api.nova.novaclient
        self._original_neutronclient = api.neutron.neutronclient
        self._original_cinderclient = api.cinder.cinderclient
        self._original_heatclient = api.heat.heatclient

        # Replace the clients with our stubs.
        api.glance.glanceclient = fake_glanceclient
        api.keystone.keystoneclient = fake_keystoneclient
        api.nova.novaclient = fake_novaclient
        api.neutron.neutronclient = lambda request: self.stub_neutronclient()
        api.cinder.cinderclient = lambda request: self.stub_cinderclient()
        api.heat.heatclient = (lambda request, password=None:
                               self.stub_heatclient())
Пример #8
0
    def setUp(self):
        super(APITestCase, self).setUp()
        LOG.warning("APITestCase has been deprecated in favor of mock usage "
                    "and will be removed at the beginning of 'Stein' release. "
                    "Please convert your to use APIMockTestCase instead.")
        utils.patch_middleware_get_user()

        def fake_keystoneclient(request, admin=False):
            """Returns the stub keystoneclient.

            Only necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_keystoneclient()

        def fake_glanceclient(request, version='1'):
            """Returns the stub glanceclient.

            Only necessary because the function takes too many arguments to
            conveniently be a lambda.
            """
            return self.stub_glanceclient()

        def fake_novaclient(request, version=None):
            return self.stub_novaclient()

        # Store the original clients
        self._original_glanceclient = api.glance.glanceclient
        self._original_keystoneclient = api.keystone.keystoneclient
        self._original_novaclient = api.nova.novaclient
        self._original_neutronclient = api.neutron.neutronclient
        self._original_cinderclient = api.cinder.cinderclient

        # Replace the clients with our stubs.
        api.glance.glanceclient = fake_glanceclient
        api.keystone.keystoneclient = fake_keystoneclient
        api.nova.novaclient = fake_novaclient
        api.neutron.neutronclient = lambda request: self.stub_neutronclient()
        api.cinder.cinderclient = lambda request: self.stub_cinderclient()
Пример #9
0
# Ensure that we always have a SECRET_KEY set, even when no local_settings.py
# file is present. See local_settings.py.example for full documentation on the
# horizon.utils.secret_key module and its use.
if not SECRET_KEY:
    if not LOCAL_PATH:
        LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                  'local')

    from horizon.utils import secret_key
    SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH,
                                                       '.secret_key_store'))

from openstack_dashboard import policy
POLICY_CHECK_FUNCTION = policy.check

# Add HORIZON_CONFIG to the context information for offline compression
COMPRESS_OFFLINE_CONTEXT = {
    'STATIC_URL': STATIC_URL,
    'HORIZON_CONFIG': HORIZON_CONFIG
}

if DEBUG:
    logging.basicConfig(level=logging.DEBUG)

# during django reloads and an active user is logged in, the monkey
# patch below will not otherwise be applied in time - resulting in developers
# appearing to be logged out.  In typical production deployments this section
# below may be ommited, though it should not be harmful
from openstack_auth import utils as auth_utils
auth_utils.patch_middleware_get_user()
Пример #10
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from django.conf.urls import patterns
from django.conf.urls import url

from openstack_auth import utils

utils.patch_middleware_get_user()


urlpatterns = patterns(
    'openstack_auth.views',
    url(r"^login/$", "login", name='login'),
    url(r"^logout/$", 'logout', name='logout'),
    url(r'^switch/(?P<tenant_id>[^/]+)/$', 'switch', name='switch_tenants'),
    url(r'^switch_services_region/(?P<region_name>[^/]+)/$', 'switch_region',
        name='switch_services_region')
)

if utils.is_websso_enabled():
    urlpatterns += patterns(
        'openstack_auth.views',
        url(r"^websso/$", "websso", name='websso')
Пример #11
0
if not SECRET_KEY:
    if not LOCAL_PATH:
        LOCAL_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                  'local')

    from horizon.utils import secret_key
    SECRET_KEY = secret_key.generate_or_read_from_file(
        os.path.join(LOCAL_PATH, '.secret_key_store'))

from openstack_dashboard import policy_backend

POLICY_CHECK_FUNCTION = policy_backend.check

# Add HORIZON_CONFIG to the context information for offline compression
COMPRESS_OFFLINE_CONTEXT = {
    'WEBROOT': WEBROOT,
    'STATIC_URL': STATIC_URL,
    'HORIZON_CONFIG': HORIZON_CONFIG,
}

if DEBUG:
    logging.basicConfig(level=logging.DEBUG)

# during django reloads and an active user is logged in, the monkey
# patch below will not otherwise be applied in time - resulting in developers
# appearing to be logged out.  In typical production deployments this section
# below may be omitted, though it should not be harmful
from openstack_auth import utils as auth_utils

auth_utils.patch_middleware_get_user()
Пример #12
0
 def setUp(self):
     super(APITestCase, self).setUp()
     utils.patch_middleware_get_user()
Пример #13
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from django.conf.urls import url
from django.views import generic

from openstack_auth import utils
from openstack_auth import views

utils.patch_middleware_get_user()

urlpatterns = [
    url(r"^login/$", views.login, name='login'),
    url(r"^logout/$", views.logout, name='logout'),
    url(r'^switch/(?P<tenant_id>[^/]+)/$', views.switch,
        name='switch_tenants'),
    url(r'^switch_services_region/(?P<region_name>[^/]+)/$',
        views.switch_region,
        name='switch_services_region'),
    url(r'^switch_keystone_provider/(?P<keystone_provider>[^/]+)/$',
        views.switch_keystone_provider,
        name='switch_keystone_provider')
]

if utils.is_websso_enabled():
Пример #14
0
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView

from openstack_auth.utils import patch_middleware_get_user


patch_middleware_get_user()


urlpatterns = patterns('',
    url(r"", include('openstack_auth.urls')),
    url(r"^$", TemplateView.as_view(template_name="auth/blank.html"))
)
Пример #15
0
 def setUp(self):
     super().setUp()
     utils.patch_middleware_get_user()
Пример #16
0
#
# This is the entry point for the dashboard
# in /usr/share/openstack-dashboard/openstack_dashboard/urls.py
# it is necessary to register:
# url(r'^auth/', include('openstack_auth_shib.urls'))
# instead of
# url(r'^auth/', include('openstack_auth.urls'))
#

from django import VERSION as django_version
from django.conf.urls import url
from openstack_auth.utils import patch_middleware_get_user
from openstack_auth_shib import views

patch_middleware_get_user()

login_url = url(r"^login/$", views.login, name='login')
websso_url = url(r"^websso/$", views.websso, name='websso')
logout_url = url(r"^logout/$", views.logout, name='logout')
switch_url = url(r'^switch/(?P<tenant_id>[^/]+)/$',
                 views.switch,
                 name='switch_tenants')
sw_reg_url = url(r'^switch_services_region/(?P<region_name>[^/]+)/$',
                 views.switch_region,
                 name='switch_services_region')
regis_url = url(r"^register/$", views.RegistrView.as_view(), name='register')
reg_ok_url = url(r"^reg_done/$", views.reg_done, name='reg_done')
namex_url = url(r"^name_exists/$", views.name_exists, name='name_exists')
fail_url = url(r"^reg_failure/$", views.reg_failure, name='reg_failure')
dup_url = url(r"^dup_login/$", views.dup_login, name='dup_login')