def test_imports_with_classes(self): zp = ZenPack('a.b.c') c = Component(zp, 'Componentk', klasses=['Products.ZenModel.OSComponent.OSComponent', 'Products.ZenModel.Linkable.Layer2Linkable' ] ) c2 = Component(zp, 'Componentk2', klasses=['Products.ZenModel.Software.Software', ] ) self.maxDiff = None expected = ['from zope.interface import implements', 'from Products.ZenModel.ZenossSecurity import ZEN_CHANGE_DEVICE', 'from Products.Zuul.decorators import info', 'from Products.Zuul.form import schema', 'from Products.Zuul.infos import ProxyProperty', 'from Products.Zuul.utils import ZuulMessageFactory as _t', 'from Products.ZenModel.OSComponent import OSComponent', 'from Products.ZenModel.Linkable import Layer2Linkable', ] for e in expected: self.assertTrue(e in c.imports) expected = ['from zope.interface import implements', 'from Products.ZenModel.ZenossSecurity import ZEN_CHANGE_DEVICE', 'from Products.Zuul.decorators import info', 'from Products.Zuul.form import schema', 'from Products.Zuul.infos import ProxyProperty', 'from Products.Zuul.utils import ZuulMessageFactory as _t', 'from Products.ZenModel.Software import Software', ] for e in expected: self.assertTrue(e in c2.imports)
def setUp(self): self.zp = ZenPack(DEFAULT_NAME) self.mkdir = os.mkdir self.makedirs = os.makedirs os.mkdir = MagicMock(return_value=True) os.makedirs = MagicMock(return_value=True)
def test_zProperties(self): zp = ZenPack('a.a.c', zProperties=[{ "type_": "boolean", "default": True, "Category": "NetBotz", "name": "zNetBotzExample" }, { "name": "e1" }]) self.assertEqual( zp.zproperties, { 'e1': ('e1', "''", 'string', None), 'zNetBotzExample': ('zNetBotzExample', True, 'boolean', 'NetBotz') })
def test_relationships(self): zp = ZenPack('a.a.e', deviceClasses=[{ "path": "Device/Snmp", "componentTypes": [{ "name": "Enclosure" }, { "name": "TemperatureSensor" }, { "name": "Fan" }] }], relationships=[{ "componentA": "Enclosure", "componentB": "Fan", "contained": False }]) self.assertEqual(zp.relationships.keys(), [ 'Products.ZenModel.Device.Device a.a.e.TemperatureSensor', 'a.a.e.Enclosure a.a.e.Fan', 'Products.ZenModel.Device.Device a.a.e.Enclosure', 'Products.ZenModel.Device.Device a.a.e.Fan' ])
def setUp(self): self.zp = ZenPack('a.b.c')
def setUp(self): from zpg.ZenPack import ZenPack self.zp = ZenPack(DEFAULT_NAME) self.makedirs = os.makedirs os.makedirs = MagicMock(return_value=True)
def setUp(self): self.zp = ZenPack(DEFAULT_NAME2)
def setUp(self): self.zp = ZenPack('a.b.c') self.makedirs = os.makedirs os.makedirs = MagicMock(return_value=True)
def setUp(self): self.zp = ZenPack('a.a.Template')
def setUp(self): self.zp = ZenPack(DEFAULT_NAME, opts=Opts()) self.makedirs = os.makedirs os.makedirs = MagicMock(return_value=True)
def setUp(self): if hasattr(self, 'zp'): del(self.zp) self.zp = ZenPack(DEFAULT_NAME, opts=Opts())
def test_deviceClasses(self): zp = ZenPack('a.a.d', deviceClasses=[{"path": "Device/Snmp"}]) self.assertEqual(zp.deviceClasses.keys(), ['/zport/dmd/Device/Snmp'])
def test_installRequires(self): self.assertEqual( ZenPack('a.a.a', install_requires='foo').install_requires, ['foo']) self.assertEqual( ZenPack('a.a.b', install_requires=['foo']).install_requires, ['foo'])
def setUp(self): self.zp = ZenPack('a.a.Configure')