summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authortermie <github@anarkystic.com>2012-03-01 11:27:06 -0800
committerAdam Young <ayoung@redhat.com>2012-03-01 15:39:22 -0500
commitdd35d2afbfc7bcd41cd5c68b440f5c502d32d656 (patch)
tree94e88a260e57bcc1d52cd559083b48cfa8a7edd7 /tests
parentf8ba5af130b7ec2d2ec8c0abcadbc27275467ab8 (diff)
downloadkeystone-dd35d2afbfc7bcd41cd5c68b440f5c502d32d656.tar.gz
keystone-dd35d2afbfc7bcd41cd5c68b440f5c502d32d656.tar.xz
keystone-dd35d2afbfc7bcd41cd5c68b440f5c502d32d656.zip
standardize ldap and related tests
ldap was accidentally supplying some of its own values rather than using the built-in fixtures, so it was providing the incorrect interface for a couple calls. also adds a test for get_user_by_name (skipped for ldap) and standardizes the kvs and ldap authenticate calls fix user authentication live ldap tests Change-Id: If1ccce1fd9c84622bb89344bc5d5c59b059d03ae
Diffstat (limited to 'tests')
-rw-r--r--tests/_ldap_livetest.py18
-rw-r--r--tests/test_backend.py10
-rw-r--r--tests/test_backend_ldap.py9
3 files changed, 23 insertions, 14 deletions
diff --git a/tests/_ldap_livetest.py b/tests/_ldap_livetest.py
index 76b2e7e1..167e0e51 100644
--- a/tests/_ldap_livetest.py
+++ b/tests/_ldap_livetest.py
@@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import subprocess
+import nose.exc
from keystone import config
from keystone import test
@@ -27,20 +28,20 @@ def delete_object(name):
def clear_live_database():
roles = ['keystone_admin']
- groups = ['baz', 'bar', 'tenent4add','fake1','fake2']
- users = ['foo', 'two','fake1','fake2']
+ groups = ['baz', 'bar', 'tenent4add', 'fake1', 'fake2']
+ users = ['foo', 'two', 'fake1', 'fake2']
roles = ['keystone_admin', 'useless']
for group in groups:
for role in roles:
- delete_object ('cn=%s,cn=%s,ou=Groups' % (role, group))
+ delete_object('cn=%s,cn=%s,ou=Groups' % (role, group))
delete_object('cn=%s,ou=Groups' % group)
for user in users:
- delete_object ('cn=%s,ou=Users' % user)
+ delete_object('cn=%s,ou=Users' % user)
for role in roles:
- delete_object ('cn=%s,ou=Roles' % role)
+ delete_object('cn=%s,ou=Roles' % role)
class LDAPIdentity(test.TestCase, test_backend.IdentityTests):
@@ -52,10 +53,9 @@ class LDAPIdentity(test.TestCase, test_backend.IdentityTests):
clear_live_database()
self.identity_api = identity_ldap.Identity()
self.load_fixtures(default_fixtures)
- self.user_foo = {'id': 'foo',
- 'name': 'FOO',
- 'password': 'foo2',
- 'tenants': ['bar']}
def tearDown(self):
test.TestCase.tearDown(self)
+
+ def test_get_user_by_name(self):
+ raise nose.exc.SkipTest('not implemented in ldap yet')
diff --git a/tests/test_backend.py b/tests/test_backend.py
index 01ac73ea..dc566252 100644
--- a/tests/test_backend.py
+++ b/tests/test_backend.py
@@ -71,7 +71,6 @@ class IdentityTests(object):
user_ref = self.identity_api._get_user(self.user_foo['id'])
self.assertNotEqual(user_ref['password'], self.user_foo['password'])
-
def test_get_tenant_bad_tenant(self):
tenant_ref = self.identity_api.get_tenant(
tenant_id=self.tenant_bar['id'] + 'WRONG')
@@ -105,6 +104,15 @@ class IdentityTests(object):
self.user_foo.pop('password')
self.assertDictEquals(user_ref, self.user_foo)
+ def test_get_user_by_name(self):
+ user_ref = self.identity_api.get_user_by_name(
+ user_name=self.user_foo['name'])
+ # NOTE(termie): the password field is left in user_foo to make it easier
+ # to authenticate in tests, but should not be returned by
+ # the api
+ self.user_foo.pop('password')
+ self.assertDictEquals(user_ref, self.user_foo)
+
def test_get_metadata_bad_user(self):
metadata_ref = self.identity_api.get_metadata(
user_id=self.user_foo['id'] + 'WRONG',
diff --git a/tests/test_backend_ldap.py b/tests/test_backend_ldap.py
index 06bf0735..b989bcef 100644
--- a/tests/test_backend_ldap.py
+++ b/tests/test_backend_ldap.py
@@ -1,5 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
+import nose.exc
+
from keystone import config
from keystone import test
from keystone.common.ldap import fakeldap
@@ -26,10 +28,9 @@ class LDAPIdentity(test.TestCase, test_backend.IdentityTests):
clear_database()
self.identity_api = identity_ldap.Identity()
self.load_fixtures(default_fixtures)
- self.user_foo = {'id': 'foo',
- 'name': 'FOO',
- 'password': 'foo2',
- 'tenants': ['bar']}
def tearDown(self):
test.TestCase.tearDown(self)
+
+ def test_get_user_by_name(self):
+ raise nose.exc.SkipTest('not implemented in ldap yet')