X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=centos7%2Frpm%2FSOURCES%2F0003-Add-missing-_-import-to-plugin-base.py.patch;fp=centos7%2Frpm%2FSOURCES%2F0003-Add-missing-_-import-to-plugin-base.py.patch;h=20be66cdf4b3c5f4542f37c4decd8d3af45c869a;hb=596aa6e8beb9da4bd365f1eeb5797a6623976e3a;hp=0000000000000000000000000000000000000000;hpb=47a7652618c0ac9a68df977e3973a07bce92ebdd;p=openstack-build%2Fdjango_openstack_auth-build.git diff --git a/centos7/rpm/SOURCES/0003-Add-missing-_-import-to-plugin-base.py.patch b/centos7/rpm/SOURCES/0003-Add-missing-_-import-to-plugin-base.py.patch new file mode 100644 index 0000000..20be66c --- /dev/null +++ b/centos7/rpm/SOURCES/0003-Add-missing-_-import-to-plugin-base.py.patch @@ -0,0 +1,72 @@ +From cdf4d30db30bffa44095b07f761183c10316e659 Mon Sep 17 00:00:00 2001 +From: Doug Fish +Date: Wed, 6 May 2015 05:42:22 -0500 +Subject: [PATCH] Add missing _ import to plugin/base.py + +Change-Id: I790246d8c5c8702a6d8b5a3abb07cd46297e051a +Closes-Bug: 1452232 +(cherry picked from commit 8aa02932c3efff3a2f17db474d0f024dbfc38bda) +(cherry picked from commit 124a35baea01ea9c81a268d0c3bd09932b4e00cd) +--- + openstack_auth/plugin/base.py | 1 + + openstack_auth/tests/tests.py | 28 ++++++++++++++++++++++++++++ + 2 files changed, 29 insertions(+) + +diff --git a/openstack_auth/plugin/base.py b/openstack_auth/plugin/base.py +index a2fc755..e3bd802 100644 +--- a/openstack_auth/plugin/base.py ++++ b/openstack_auth/plugin/base.py +@@ -12,6 +12,7 @@ + + import abc + ++from django.utils.translation import ugettext_lazy as _ + from keystoneclient import exceptions as keystone_exceptions + from keystoneclient.v2_0 import client as v2_client + from keystoneclient.v3 import client as v3_client +diff --git a/openstack_auth/tests/tests.py b/openstack_auth/tests/tests.py +index 29bfa3d..09bdc76 100644 +--- a/openstack_auth/tests/tests.py ++++ b/openstack_auth/tests/tests.py +@@ -474,6 +474,15 @@ class OpenStackAuthTestsV3(OpenStackAuthTestsMixin, test.TestCase): + client.projects = self.mox.CreateMockAnything() + client.projects.list(user=user.id).AndReturn(projects) + ++ def _mock_unscoped_client_list_projects_fail(self, user): ++ client = self._mock_unscoped_client(user) ++ self._mock_unscoped_list_projects_fail(client, user) ++ ++ def _mock_unscoped_list_projects_fail(self, client, user): ++ client.projects = self.mox.CreateMockAnything() ++ client.projects.list(user=user.id).AndRaise( ++ keystone_exceptions.AuthorizationFailure) ++ + def _create_password_auth(self, username=None, password=None, url=None): + if not username: + username = self.data.user.name +@@ -607,6 +616,25 @@ class OpenStackAuthTestsV3(OpenStackAuthTestsMixin, test.TestCase): + self.assertContains(response, + 'You are not authorized for any projects.') + ++ def test_fail_projects(self): ++ user = self.data.user ++ ++ form_data = self.get_form_data(user) ++ self._mock_unscoped_client_list_projects_fail(user) ++ self.mox.ReplayAll() ++ ++ url = reverse('login') ++ ++ # GET the page to set the test cookie. ++ response = self.client.get(url, form_data) ++ self.assertEqual(response.status_code, 200) ++ ++ # POST to the page to log in. ++ response = self.client.post(url, form_data) ++ self.assertTemplateUsed(response, 'auth/login.html') ++ self.assertContains(response, ++ 'Unable to retrieve authorized projects.') ++ + def test_invalid_credentials(self): + user = self.data.user +