diff options
author | Konstantin Maximov <konstantin.maximov@ru.ibm.com> | 2015-02-17 16:41:24 +0300 |
---|---|---|
committer | ayoung <ayoung@redhat.com> | 2015-04-07 14:37:04 +0000 |
commit | 9c797ef41cbe13aa826e9e170628725b6c090e40 (patch) | |
tree | 1b4f47f71fad50f3868a1e5993a5fe8a1ae5574a | |
parent | 102032597df80b95b3810778353cddde53bec250 (diff) | |
download | keystone-9c797ef41cbe13aa826e9e170628725b6c090e40.tar.gz |
Improved policy setting in the 'v3 filter' tests
The test case class IdentityTestListLimitCase (test_v3_filters.py)
always sets multiple policies for the each test defined in that class.
However, only one policy is really needed for each test case.
That appears to lead to unreliable policy checking.
It would be better to set only one policy required for the particular
test case (policy with the type of entity used in the test case).
Change-Id: I7892950b43c56ecce03677d8d592e71359bedf27
Closes-Bug: #1271273
-rw-r--r-- | keystone/tests/unit/test_v3_filters.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/keystone/tests/unit/test_v3_filters.py b/keystone/tests/unit/test_v3_filters.py index 4ad44657e..9e87cc7cd 100644 --- a/keystone/tests/unit/test_v3_filters.py +++ b/keystone/tests/unit/test_v3_filters.py @@ -331,12 +331,6 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase): super(IdentityTestListLimitCase, self).setUp() - self._set_policy({"identity:list_users": [], - "identity:list_groups": [], - "identity:list_projects": [], - "identity:list_services": [], - "identity:list_policies": []}) - # Create 10 entries for each of the entities we are going to test self.ENTITY_TYPES = ['user', 'group', 'project'] self.entity_lists = {} @@ -398,6 +392,7 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase): else: plural = '%ss' % entity + self._set_policy({"identity:list_%s" % plural: []}) self.config_fixture.config(list_limit=5) self.config_fixture.config(group=driver, list_limit=None) r = self.get('/%s' % plural, auth=self.auth) @@ -435,6 +430,7 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase): def test_no_limit(self): """Check truncated attribute not set when list not limited.""" + self._set_policy({"identity:list_services": []}) r = self.get('/services', auth=self.auth) self.assertEqual(10, len(r.result.get('services'))) self.assertIsNone(r.result.get('truncated')) @@ -445,6 +441,7 @@ class IdentityTestListLimitCase(IdentityTestFilteredCase): # Test this by overriding the general limit with a higher # driver-specific limit (allowing all entities to be returned # in the collection), which should result in a non truncated list + self._set_policy({"identity:list_services": []}) self.config_fixture.config(list_limit=5) self.config_fixture.config(group='catalog', list_limit=10) r = self.get('/services', auth=self.auth) |