Kind locations must be relative

Change-Id: Icdf52cbe6cc3f5183c39b02f96c8dd6998cdb1aa
Closes-Bug: #1507939
This commit is contained in:
Enol Fernandez 2015-10-20 08:11:40 +00:00
parent 4a83fbf624
commit 800ed1d83b
5 changed files with 9 additions and 4 deletions

View File

@ -34,7 +34,7 @@ class NetworkResource(resource.Resource):
"occi.network.state"])
actions = (up, down)
kind = kind.Kind(helpers.build_scheme('infrastructure'), 'network',
'network resource', attributes, '/network/',
'network resource', attributes, 'network/',
actions=actions,
related=[resource.Resource.kind])

View File

@ -27,7 +27,7 @@ class NetworkInterface(link.Link):
"occi.networkinterface.state"])
kind = kind.Kind(helpers.build_scheme('infrastructure'),
'networkinterface', 'network link resource',
attributes, '/networklink/',
attributes, 'networklink/',
related=[link.Link.kind])
def __init__(self, mixins, source, target, id=None, interface=None,

View File

@ -41,7 +41,7 @@ class StorageResource(resource.Resource):
"occi.storage.state"])
actions = (online, offline, backup, snapshot, resize)
kind = kind.Kind(helpers.build_scheme('infrastructure'), 'storage',
'storage resource', attributes, '/storage/',
'storage resource', attributes, 'storage/',
actions=actions,
related=[resource.Resource.kind])

View File

@ -25,7 +25,7 @@ class StorageLink(link.Link):
"occi.storagelink.mountpoint",
"occi.storagelink.state"])
kind = kind.Kind(helpers.build_scheme('infrastructure'), 'storagelink',
'storage link resource', attributes, '/storagelink/',
'storage link resource', attributes, 'storagelink/',
related=[link.Link.kind])
def __init__(self, source, target, deviceid=None, mountpoint=None,

View File

@ -45,6 +45,7 @@ class TestOCCICompute(base.TestCase):
self.assertIn("occi.compute.speed", c.attributes)
self.assertIn("occi.compute.state", c.attributes)
self.assertIn(resource.Resource.kind, c.kind.related)
self.assertEqual(c.kind.location, "compute/")
# TODO(aloga): We need to check that the attributes are actually set
# after we get an object (we have to check this for this but also for
# the other resources)
@ -106,6 +107,7 @@ class TestOCCIStorage(base.TestCase):
self.assertIn("occi.storage.size", s.attributes)
self.assertIn("occi.storage.state", s.attributes)
self.assertIn(resource.Resource.kind, s.kind.related)
self.assertEqual(s.kind.location, "storage/")
# TODO(aloga): We need to check that the attributes are actually set
# after we get an object (we have to check this for this but also for
# the other resources)
@ -143,6 +145,7 @@ class TestOCCIStorageLink(base.TestCase):
self.assertIn("occi.storagelink.deviceid", s.attributes)
self.assertIn("occi.storagelink.state", s.attributes)
self.assertIn(link.Link.kind, s.kind.related)
self.assertEqual(s.kind.location, "storagelink/")
def test_storagelink(self):
server_id = uuid.uuid4().hex
@ -215,6 +218,7 @@ class TestOCCINetwork(base.TestCase):
self.assertIn("occi.network.label", n.attributes)
self.assertIn("occi.network.state", n.attributes)
self.assertIn(resource.Resource.kind, n.kind.related)
self.assertEqual(n.kind.location, "network/")
# TODO(aloga): We need to check that the attributes are actually set
# after we get an object (we have to check this for this but also for
# the other resources)
@ -280,6 +284,7 @@ class TestOCCINetworkInterface(base.TestCase):
self.assertIn("occi.networkinterface.mac", l.attributes)
self.assertIn("occi.networkinterface.state", l.attributes)
self.assertIn(link.Link.kind, l.kind.related)
self.assertEqual(l.kind.location, "networklink/")
def test_networkinterface(self):
c = compute.ComputeResource("foo",