Add source to Resource API object
This change add the source the resource API object Fixes bug #1243651 Change-Id: I4489d34c83d3af7818d3f94afaa31b493df7549d
This commit is contained in:
parent
4e5ad43cee
commit
2b550c096e
@ -897,6 +897,9 @@ class Resource(_Base):
|
||||
links = [Link]
|
||||
"A list containing a self link and associated meter links"
|
||||
|
||||
source = wtypes.text
|
||||
"The source where the resource come from"
|
||||
|
||||
def __init__(self, metadata={}, **kwds):
|
||||
metadata = _flatten_metadata(metadata)
|
||||
super(Resource, self).__init__(metadata=metadata, **kwds)
|
||||
@ -907,6 +910,7 @@ class Resource(_Base):
|
||||
project_id='35b17138-b364-4e6a-a131-8f3099c5be68',
|
||||
user_id='efd87807-12d2-4b38-9c70-5f5c2ac427ff',
|
||||
timestamp=datetime.datetime.utcnow(),
|
||||
source="openstack",
|
||||
metadata={'name1': 'value1',
|
||||
'name2': 'value2'},
|
||||
links=[Link(href=('http://localhost:8777/v2/resources/'
|
||||
|
@ -201,6 +201,8 @@ class TestListResources(FunctionalTest,
|
||||
}])
|
||||
ids = [r['resource_id'] for r in data]
|
||||
self.assertEqual(['resource-id'], ids)
|
||||
sources = [r['source'] for r in data]
|
||||
self.assertEqual(['test_list_resources'], sources)
|
||||
|
||||
def test_with_invalid_resource_id(self):
|
||||
sample1 = sample.Sample(
|
||||
|
Loading…
Reference in New Issue
Block a user