diff options
Diffstat (limited to 'tests/test_keystoneclient.py')
-rw-r--r-- | tests/test_keystoneclient.py | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/tests/test_keystoneclient.py b/tests/test_keystoneclient.py index b9828559..38062d4b 100644 --- a/tests/test_keystoneclient.py +++ b/tests/test_keystoneclient.py @@ -17,8 +17,6 @@ import uuid import webob -import nose.exc - from keystone import test from keystone import config @@ -37,23 +35,25 @@ class CompatTestCase(test.TestCase): def setUp(self): super(CompatTestCase, self).setUp() - revdir = test.checkout_vendor(*self.get_checkout()) - self.add_path(revdir) - self.clear_module('keystoneclient') + # The backends should be loaded and initialized before the servers are + # started because the servers use the backends. self.load_backends() self.load_fixtures(default_fixtures) + # TODO(termie): add an admin user to the fixtures and use that user + # override the fixtures, for now + self.metadata_foobar = self.identity_api.add_role_to_user_and_project( + self.user_foo['id'], + self.tenant_bar['id'], + self.role_admin['id']) + self.public_server = self.serveapp('keystone', name='main') self.admin_server = self.serveapp('keystone', name='admin') - # TODO(termie): is_admin is being deprecated once the policy stuff - # is all working - # TODO(termie): add an admin user to the fixtures and use that user - # override the fixtures, for now - self.metadata_foobar = self.identity_api.update_metadata( - self.user_foo['id'], self.tenant_bar['id'], - dict(roles=[self.role_admin['id']], is_admin='1')) + revdir = test.checkout_vendor(*self.get_checkout()) + self.add_path(revdir) + self.clear_module('keystoneclient') def tearDown(self): self.public_server.kill() @@ -537,7 +537,7 @@ class KeystoneClientTests(object): user=uuid.uuid4().hex) def test_user_update_tenant_404(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') from keystoneclient import exceptions as client_exceptions client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, @@ -840,6 +840,28 @@ class KcMasterTestCase(CompatTestCase, KeystoneClientTests): def get_checkout(self): return KEYSTONECLIENT_REPO, 'master' + def test_ec2_auth(self): + client = self.get_client() + cred = client.ec2.create(user_id=self.user_foo['id'], + tenant_id=self.tenant_bar['id']) + + from keystoneclient.contrib.ec2 import utils as ec2_utils + signer = ec2_utils.Ec2Signer(cred.secret) + credentials = {'params': {'SignatureVersion': '2'}, + 'access': cred.access, + 'verb': 'GET', + 'host': 'localhost', + 'path': '/thisisgoingtowork'} + signature = signer.generate(credentials) + credentials['signature'] = signature + url = '%s/ec2tokens' % (client.auth_url) + (resp, token) = client.request(url=url, + method='POST', + body={'credentials': credentials}) + # make sure we have a v2 token + self.assertEqual(resp.status_code, 200) + self.assertIn('access', token) + def test_tenant_add_and_remove_user(self): client = self.get_client(admin=True) client.roles.add_user_role(tenant=self.tenant_bar['id'], @@ -1086,10 +1108,10 @@ class KcEssex3TestCase(CompatTestCase, KeystoneClientTests): self.assertTrue(len(roles) > 0) def test_role_list_404(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') def test_authenticate_and_delete_token(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') def test_user_create_update_delete(self): from keystoneclient import exceptions as client_exceptions @@ -1133,16 +1155,16 @@ class KcEssex3TestCase(CompatTestCase, KeystoneClientTests): user.id) def test_user_update_404(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') def test_endpoint_create_404(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') def test_endpoint_delete_404(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') def test_policy_crud(self): - raise nose.exc.SkipTest('N/A due to lack of endpoint CRUD') + self.skipTest('N/A due to lack of endpoint CRUD') class Kc11TestCase(CompatTestCase, KeystoneClientTests): @@ -1150,4 +1172,4 @@ class Kc11TestCase(CompatTestCase, KeystoneClientTests): return KEYSTONECLIENT_REPO, '0.1.1' def test_policy_crud(self): - raise nose.exc.SkipTest('N/A') + self.skipTest('N/A') |