From 6f4096bc884339110eef719831bfa91d9b1d2e63 Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Mon, 8 Apr 2013 19:53:15 -0500 Subject: [PATCH] clean up invalid variable reference keystone.auth.controllers.AuthInfo's get_method_data() referenced a variable that was not defined. Change-Id: I4171453d5e9843501052c9e395273976255342ad --- keystone/auth/controllers.py | 2 +- tests/test_v3_auth.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/keystone/auth/controllers.py b/keystone/auth/controllers.py index 113655db4a..479ec2cdac 100644 --- a/keystone/auth/controllers.py +++ b/keystone/auth/controllers.py @@ -237,7 +237,7 @@ class AuthInfo(object): """ if method not in self.auth['identity']['methods']: - raise exception.ValidationError(attribute=method_name, + raise exception.ValidationError(attribute=method, target='identity') return self.auth['identity'][method] diff --git a/tests/test_v3_auth.py b/tests/test_v3_auth.py index a292af2b48..997165eccf 100644 --- a/tests/test_v3_auth.py +++ b/tests/test_v3_auth.py @@ -83,6 +83,18 @@ class TestAuthInfo(test_v3.RestfulTestCase): None, auth_data) + def test_get_method_data_invalid_method(self): + auth_data = self.build_authentication_request( + user_id='test', + password='test')['auth'] + context = None + auth_info = auth.controllers.AuthInfo(context, auth_data) + + method_name = uuid.uuid4().hex + self.assertRaises(exception.ValidationError, + auth_info.get_method_data, + method_name) + class TestTokenAPIs(test_v3.RestfulTestCase): def setUp(self):