Merge "Add source to Resource API object"
This commit is contained in:
commit
4b2275db19
@ -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