def testManytoManyCont(self): dc = self.zp.addDeviceClass('Device', zPythonClass='a.b.c.d.e.Device') e = dc.addComponentType('a.b.Enclosure') Relationship(self.zp, 'a.b.Enclosure', 'a.b.Disk', Type='M-M', Contained=True) d = Component(self.zp, 'a.b.Disk') d.updateImports() e.updateImports() self.assertTrue('from Products.ZenRelations.RelSchema import ToMany,ToManyCont' in d.imports)
def testOnetoOne(self): dc = self.zp.addDeviceClass('Device', zPythonClass='a.b.c.d.Device') e = dc.addComponentType('a.Enclosure') Relationship(self.zp, 'a.Enclosure', 'a.Disk', Type='1-1', Contained=False) d = Component(self.zp, 'a.Disk') d.updateImports() e.updateImports() self.assertTrue('from Products.ZenRelations.RelSchema import ToOne' in d.imports)