def test_returnsOneToMany(self): d2 = Component(self.zp, 'Device2') c2 = Component(self.zp, 'Component2') r2 = Relationship(self.zp, 'Device2', 'Component2', contained=False) self.assertEqual( "('component2s', ToMany(ToOne, 'a.b.c.Component2', 'device2',)),", r2.toString(d2)) self.assertEqual( "('device2', ToOne(ToMany, 'a.b.c.Device2', 'component2s',)),", r2.toString(c2))
def test_returnsManyToManyCont(self): d4 = Component(self.zp, 'Device4') c4 = Component(self.zp, 'Component4') r4 = Relationship(self.zp, 'Device4', 'Component4', type_='M-M') self.assertEqual( "('component4s', ToMany(ToManyCont, 'a.b.c.Component4', 'device4s',)),", r4.toString(d4)) self.assertEqual( "('device4s', ToManyCont(ToMany, 'a.b.c.Device4', 'component4s',)),", r4.toString(c4))
def test_returnsOneToManyCont(self): d = Component(self.zp, 'Device') c = Component(self.zp, 'Component') r = Relationship(self.zp, 'Device', 'Component') self.assertEqual( "('components', ToManyCont(ToOne, 'a.b.c.Component', 'device',)),", r.toString(d)) self.assertEqual( "('device', ToOne(ToManyCont, 'a.b.c.Device', 'components',)),", r.toString(c))
def test_returnsManyToMany(self): d5 = Component(self.zp, 'Device5') c5 = Component(self.zp, 'Component5') r5 = Relationship( self.zp, 'Device5', 'Component5', contained=False, type_='M-M') self.assertEqual( "('component5s', ToMany(ToMany, 'a.b.c.Component5', 'device5s',)),", r5.toString(d5)) self.assertEqual( "('device5s', ToMany(ToMany, 'a.b.c.Device5', 'component5s',)),", r5.toString(c5))
def test_returnsOneToOne(self): d3 = Component(self.zp, 'Device3') c3 = Component(self.zp, 'Component3') r3 = Relationship( self.zp, 'Device3', 'Component3', contained=False, type_='1-1') self.assertEqual( "('component3', ToOne(ToOne, 'a.b.c.Component3', 'device3',)),", r3.toString(d3)) self.assertEqual( "('device3', ToOne(ToOne, 'a.b.c.Device3', 'component3',)),", r3.toString(c3))
def test_returnsManyToMany(self): d5 = Component(self.zp, 'Device5') c5 = Component(self.zp, 'Component5') r5 = Relationship(self.zp, 'Device5', 'Component5', contained=False, type_='M-M') self.assertEqual( "('component5s', ToMany(ToMany, 'a.b.c.Component5', 'device5s',)),", r5.toString(d5)) self.assertEqual( "('device5s', ToMany(ToMany, 'a.b.c.Device5', 'component5s',)),", r5.toString(c5))
def test_returnsOneToOne(self): d3 = Component(self.zp, 'Device3') c3 = Component(self.zp, 'Component3') r3 = Relationship(self.zp, 'Device3', 'Component3', contained=False, type_='1-1') self.assertEqual( "('component3', ToOne(ToOne, 'a.b.c.Component3', 'device3',)),", r3.toString(d3)) self.assertEqual( "('device3', ToOne(ToOne, 'a.b.c.Device3', 'component3',)),", r3.toString(c3))