~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to test/unit/common/middleware/test_keystoneauth.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-28 09:40:30 UTC
  • mfrom: (1.2.16)
  • Revision ID: package-import@ubuntu.com-20130128094030-aetz57x2qz9ye2d4
Tags: 1.7.6-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
227
227
        acl = '%s:%s' % (identity['tenant'][0], identity['user'])
228
228
        self._check_authenticate(identity=identity, acl=acl)
229
229
 
 
230
    def test_authorize_succeeds_for_wildcard_tenant_user_in_roles(self):
 
231
        identity = self._get_identity()
 
232
        acl = '*:%s' % (identity['user'])
 
233
        self._check_authenticate(identity=identity, acl=acl)
 
234
 
 
235
    def test_cross_tenant_authorization_success(self):
 
236
        self.assertTrue(self.test_auth._authorize_cross_tenant('userA',
 
237
            'tenantID', 'tenantNAME', ['tenantID:userA']))
 
238
        self.assertTrue(self.test_auth._authorize_cross_tenant('userA',
 
239
            'tenantID', 'tenantNAME', ['tenantNAME:userA']))
 
240
        self.assertTrue(self.test_auth._authorize_cross_tenant('userA',
 
241
            'tenantID', 'tenantNAME', ['*:userA']))
 
242
 
 
243
    def test_cross_tenant_authorization_failure(self):
 
244
        self.assertFalse(self.test_auth._authorize_cross_tenant('userA',
 
245
            'tenantID', 'tenantNAME', ['tenantXYZ:userA']))
 
246
 
 
247
 
230
248
if __name__ == '__main__':
231
249
    unittest.main()