backwards compatible project id handling

This commit is contained in:
Daan Hoogland 2019-06-06 10:22:15 +02:00
parent 10a29c5d07
commit a39505cc86
2 changed files with 26 additions and 1 deletions

View File

@ -217,7 +217,7 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
}
if (resourceType == ResourceObjectType.Project) {
accountId = ((ProjectVO)entity).getProjectAccountId();
accountId = ((ProjectVO)entity).getId();
}
if (entity instanceof OwnedBy) {

View File

@ -1751,6 +1751,13 @@ class TestResourceTags(cloudstackTestCase):
)
self.debug("Tag created: %s" % tag.__dict__)
tag2 = Tag.list(
self.apiclient,
listall=True,
resourceType='project',
resourceIds=project.id,
key=tag_key,
)
tags = Tag.list(
self.apiclient,
listall=True,
@ -1760,17 +1767,35 @@ class TestResourceTags(cloudstackTestCase):
key=tag_key,
)
self.debug("tags = %s" % tags)
tag2 = Tag.list(
self.apiclient,
listall=True,
resourceType='project',
resourceIds=project.id,
key=tag_key,
)
self.debug("tag2 = %s" % tags)
self.assertEqual(
isinstance(tags, list),
True,
"List tags should not return empty response"
)
self.assertEqual(
isinstance(tag2, list),
True,
"List tags should not return empty response"
)
self.assertEqual(
tags[0].value,
tag_value,
'The tag should have original value'
)
self.assertEqual(
tag2[0].value,
tag_value,
'The tag should have original value'
)
projects = Project.list(
self.apiclient,