Allow filtering of stacks by username, tenant and owner_id

Adding username, tenant and owner_id to stacks filtering whitelist.

Change-Id: I7471743adcdbed6d70e1a808bf2430e40fa4075e
Closes-Bug: #1367439
This commit is contained in:
Vijendar Komalla 2014-09-09 16:02:40 -05:00
parent 35d7465c11
commit 8e4cec5670
2 changed files with 10 additions and 1 deletions

View File

@ -157,6 +157,9 @@ class StackController(object):
'status': 'mixed',
'name': 'mixed',
'action': 'mixed',
'tenant': 'mixed',
'username': 'mixed',
'owner_id': 'mixed',
}
whitelist = {
'limit': 'single',

View File

@ -411,6 +411,9 @@ class StackControllerTest(ControllerTest, HeatTestCase):
'status': 'fake status',
'name': 'fake name',
'action': 'fake action',
'username': 'fake username',
'tenant': 'fake tenant',
'owner_id': 'fake owner-id',
'balrog': 'you shall not pass!'
}
req = self._get('/stacks', params=params)
@ -423,10 +426,13 @@ class StackControllerTest(ControllerTest, HeatTestCase):
self.assertIn('filters', engine_args)
filters = engine_args['filters']
self.assertEqual(3, len(filters))
self.assertEqual(6, len(filters))
self.assertIn('status', filters)
self.assertIn('name', filters)
self.assertIn('action', filters)
self.assertIn('username', filters)
self.assertIn('tenant', filters)
self.assertIn('owner_id', filters)
self.assertNotIn('balrog', filters)
def test_index_returns_stack_count_if_with_count_is_true(