rbac: add some backport compat tests

The old rbac wasn't really works only the segregration was applied.
Even it's fixed now the legacy policy.json should continue to works.

Related-bug: #1504495

Conflicts:
	aodh/tests/functional/api/v2/test_alarm_scenarios.py

Change-Id: I050b2245d78780cb49b47b317a1a245b8e0a58eb
(cherry picked from commit 4101ab5d9f)
This commit is contained in:
Mehdi Abaakouk 2015-12-14 14:54:42 +01:00 committed by gordon chung
parent 410d8da15d
commit 3a05a1df61
2 changed files with 33 additions and 0 deletions

View File

@ -139,6 +139,16 @@ def default_alarms(auth_headers):
]
class LegacyPolicyFileMixin(object):
def setUp(self):
super(LegacyPolicyFileMixin, self).setUp()
self.CONF.set_override(
'policy_file',
os.path.abspath('aodh/tests/policy.json-pre-mikita'),
group='oslo_policy')
self.app = self._make_app()
class TestAlarmsBase(v2.FunctionalTest,
tests_db.MixinTestsWithBackendScenarios):
@ -1697,6 +1707,10 @@ class TestAlarms(TestAlarmsBase):
'user_id']).issubset(payload.keys()))
class TestAlarmsLegacy(LegacyPolicyFileMixin, TestAlarms):
pass
class TestAlarmsHistory(TestAlarmsBase):
def setUp(self):
@ -2052,6 +2066,10 @@ class TestAlarmsHistory(TestAlarmsBase):
self.assertEqual([], history)
class TestAlarmsHistoryLegacy(LegacyPolicyFileMixin, TestAlarmsHistory):
pass
class TestAlarmsQuotas(TestAlarmsBase):
def _test_alarm_quota(self):
@ -2737,6 +2755,11 @@ class TestAlarmsRuleCombination(TestAlarmsBase):
self.assertEqual(['c', 'a', 'b'], alarms[0].rule.get('alarm_ids'))
class TestAlarmsRuleCombinationLegacy(LegacyPolicyFileMixin,
TestAlarmsRuleCombination):
pass
class TestAlarmsRuleGnocchi(TestAlarmsBase):
def setUp(self):
@ -2999,6 +3022,11 @@ class TestAlarmsRuleGnocchi(TestAlarmsBase):
self._verify_alarm(json, alarms[0])
class TestAlarmsRuleGnocchiLegacy(LegacyPolicyFileMixin,
TestAlarmsRuleGnocchi):
pass
class TestAlarmsEvent(TestAlarmsBase):
def test_list_alarms(self):

View File

@ -0,0 +1,5 @@
{
"context_is_admin": "role:admin",
"segregation": "rule:context_is_admin",
"default": ""
}