Add user_id in resource class Policy

This patch supports user_id in resource classs Policy.

Change-Id: If088bf2e606b6bd74e520ff11b9ad2e1d97f5773
Partial-Bug: #1650120
This commit is contained in:
jonnary
2016-12-15 13:10:06 +08:00
parent 28922b3c28
commit 44796b2daa
2 changed files with 4 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ class Policy(resource.Resource):
type = resource.Body('type') type = resource.Body('type')
#: The ID of the project this policy belongs to. #: The ID of the project this policy belongs to.
project_id = resource.Body('project') project_id = resource.Body('project')
#: The ID of the user who created this policy.
user_id = resource.Body('user')
#: The timestamp when the policy is created. #: The timestamp when the policy is created.
created_at = resource.Body('created_at') created_at = resource.Body('created_at')
#: The timestamp when the policy was last updated. #: The timestamp when the policy was last updated.

View File

@@ -32,6 +32,7 @@ FAKE = {
} }
}, },
'project': '42d9e9663331431f97b75e25136307ff', 'project': '42d9e9663331431f97b75e25136307ff',
'user': '3747afc360b64702a53bdd64dc1b8976',
'type': 'senlin.policy.deletion-1.0', 'type': 'senlin.policy.deletion-1.0',
'created_at': '2015-10-10T12:46:36.000000', 'created_at': '2015-10-10T12:46:36.000000',
'updated_at': '2016-10-10T12:46:36.000000', 'updated_at': '2016-10-10T12:46:36.000000',
@@ -62,6 +63,7 @@ class TestPolicy(testtools.TestCase):
self.assertEqual(FAKE['name'], sot.name) self.assertEqual(FAKE['name'], sot.name)
self.assertEqual(FAKE['spec'], sot.spec) self.assertEqual(FAKE['spec'], sot.spec)
self.assertEqual(FAKE['project'], sot.project_id) self.assertEqual(FAKE['project'], sot.project_id)
self.assertEqual(FAKE['user'], sot.user_id)
self.assertEqual(FAKE['data'], sot.data) self.assertEqual(FAKE['data'], sot.data)
self.assertEqual(FAKE['created_at'], sot.created_at) self.assertEqual(FAKE['created_at'], sot.created_at)
self.assertEqual(FAKE['updated_at'], sot.updated_at) self.assertEqual(FAKE['updated_at'], sot.updated_at)