summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-07-22 20:20:31 +0000
committerVishvananda Ishaya <vishvananda@gmail.com>2011-07-22 20:20:31 +0000
commit0f8eee7ff32a91c866742939b1f551f3610f1276 (patch)
tree2f181ab9efd00956756d4d8a2636f84f9aee3920
parentf9fb313ca2acaf2fd491d5b695381846969b132c (diff)
downloadnova-0f8eee7ff32a91c866742939b1f551f3610f1276.tar.gz
nova-0f8eee7ff32a91c866742939b1f551f3610f1276.tar.xz
nova-0f8eee7ff32a91c866742939b1f551f3610f1276.zip
fix auth tests
-rw-r--r--nova/api/openstack/auth.py2
-rw-r--r--nova/auth/manager.py2
-rw-r--r--nova/tests/test_auth.py19
3 files changed, 11 insertions, 12 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py
index 9caa14a4e..d42abe1f8 100644
--- a/nova/api/openstack/auth.py
+++ b/nova/api/openstack/auth.py
@@ -62,7 +62,7 @@ class AuthMiddleware(wsgi.Middleware):
# while osapi clients don't use this header
projects = self.auth.get_projects(user_id)
if projects:
- project_id = projects[0]
+ project_id = projects[0].id
else:
return faults.Fault(webob.exc.HTTPUnauthorized())
diff --git a/nova/auth/manager.py b/nova/auth/manager.py
index b6131fb7f..06af7e781 100644
--- a/nova/auth/manager.py
+++ b/nova/auth/manager.py
@@ -785,7 +785,7 @@ class AuthManager(object):
return read_buffer
def get_environment_rc(self, user, project=None, use_dmz=True):
- """Get credential zip for user in project"""
+ """Get environment rc for user in project"""
if not isinstance(user, User):
user = self.get_user(user)
if project is None:
diff --git a/nova/tests/test_auth.py b/nova/tests/test_auth.py
index 71e0d17c9..7c0f783bb 100644
--- a/nova/tests/test_auth.py
+++ b/nova/tests/test_auth.py
@@ -102,7 +102,7 @@ class _AuthManagerBaseTestCase(test.TestCase):
self.assertEqual('classified', u.secret)
self.assertEqual('private-party', u.access)
- def test_004_signature_is_valid(self):
+ def test_signature_is_valid(self):
with user_generator(self.manager, name='admin', secret='admin',
access='admin'):
with project_generator(self.manager, name="admin",
@@ -141,15 +141,14 @@ class _AuthManagerBaseTestCase(test.TestCase):
'127.0.0.1',
'/services/Cloud'))
- def test_005_can_get_credentials(self):
- return
- credentials = self.manager.get_user('test1').get_credentials()
- self.assertEqual(credentials,
- 'export EC2_ACCESS_KEY="access"\n' +
- 'export EC2_SECRET_KEY="secret"\n' +
- 'export EC2_URL="http://127.0.0.1:8773/services/Cloud"\n' +
- 'export S3_URL="http://127.0.0.1:3333/"\n' +
- 'export EC2_USER_ID="test1"\n')
+ def test_can_get_credentials(self):
+ st = {'access': 'access', 'secret': 'secret'}
+ with user_and_project_generator(self.manager, user_state=st) as (u, p):
+ credentials = self.manager.get_environment_rc(u, p)
+ LOG.debug(credentials)
+ self.assertTrue('export EC2_ACCESS_KEY="access:testproj"\n'
+ in credentials)
+ self.assertTrue('export EC2_SECRET_KEY="secret"\n' in credentials)
def test_can_list_users(self):
with user_generator(self.manager):