Add applies to compute mixins

Change-Id: I2a7b9403063fa42806751a37fb9e8ec8a082a7cd
Closes-Bug: 1687938
This commit is contained in:
Enol Fernandez 2017-07-24 11:06:06 +01:00 committed by Alvaro Lopez Garcia
parent 8f669d9225
commit 9a98331c7f
3 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,7 @@
from ooi.occi.core import mixin
from ooi.occi import helpers
from ooi.occi.infrastructure import compute
class OCCIOSTemplate(mixin.Mixin):
@ -22,6 +23,7 @@ class OCCIOSTemplate(mixin.Mixin):
def __init__(self, *args, **kwargs):
kwargs.setdefault("location", self._location + "/")
kwargs.setdefault("applies", [compute.ComputeResource.kind])
super(OCCIOSTemplate, self).__init__(self.scheme, *args, **kwargs)
@ -35,6 +37,7 @@ class OCCIResourceTemplate(mixin.Mixin):
def __init__(self, *args, **kwargs):
kwargs.setdefault("location", self._location + "/")
kwargs.setdefault("applies", [compute.ComputeResource.kind])
super(OCCIResourceTemplate, self).__init__(self.scheme,
*args,
**kwargs)

View File

@ -211,12 +211,16 @@ class TestTemplates(base.TestCase):
mixin.Mixin)
self.assertEqual("os_tpl",
templates.os_tpl.term)
self.assertEqual([compute.ComputeResource.kind],
templates.os_tpl.applies)
def test_resource_tpl(self):
self.assertIsInstance(templates.resource_tpl,
mixin.Mixin)
self.assertEqual("resource_tpl",
templates.resource_tpl.term)
self.assertEqual([compute.ComputeResource.kind],
templates.os_tpl.applies)
class TestOCCINetwork(base.TestCase):

View File

@ -38,6 +38,8 @@ class TestOpenStackOSTemplate(base.TestCase):
self.assertTrue(tpl.scheme.startswith(helpers._PREFIX))
self.assertIn(occi_templates.os_tpl, tpl.depends)
self.assertEqual(location, tpl.location)
self.assertEqual([compute.ComputeResource.kind],
tpl.applies)
class TestOpenStackResourceTemplate(base.TestCase):
@ -70,6 +72,8 @@ class TestOpenStackResourceTemplate(base.TestCase):
self.assertEqual(ephemeral, tpl.ephemeral)
self.assertEqual(name, tpl.name)
self.assertEqual(location, tpl.location)
self.assertEqual([compute.ComputeResource.kind],
tpl.applies)
class TestHelpers(base.TestCase):