def test_ReturnsCorrectRelationships(self): c = self.zp.addComponentType('SampleComponent') r = Relationship(self.zp, 'SampleDevice', 'SampleComponent') self.assertEqual([r], Relationship.find(c)) self.assertEqual([], Relationship.find(c, types='1-M')) self.assertEqual([r], Relationship.find(c, types=['1-M', 'M-M'])) self.assertEqual([], Relationship.find(c, types=['1-1']))
def test_ReturnsCorrectRelationships(self): c = self.zp.addComponentType('SampleComponent') r = Relationship(self.zp, 'SampleDevice', 'SampleComponent') self.assertEqual([r], Relationship.find(c)) self.assertEqual([], Relationship.find(c, types='1-M')) self.assertEqual([r], Relationship.find(c, types=['1-M', 'M-M'])) self.assertEqual([], Relationship.find(c, types=['1-1']))
def test_ReturnsContainedRelationships(self): c = Component(self.zp, 'SampleComponent') c3 = Component(self.zp, 'SampleComponent3') r = Relationship(self.zp, 'SampleDevice', 'SampleComponent') r3 = Relationship( self.zp, 'SampleComponent3', 'SampleComponent4', contained=False) Relationship(self.zp, 'SampleComponent4', 'SampleComponent5') self.maxDiff = None self.assertEqual([r], Relationship.find(c, contained=True)) self.assertEqual([r3], Relationship.find(c3, contained=False))
def test_ReturnsContainedRelationships(self): c = Component(self.zp, 'SampleComponent') c3 = Component(self.zp, 'SampleComponent3') r = Relationship(self.zp, 'SampleDevice', 'SampleComponent') r3 = Relationship(self.zp, 'SampleComponent3', 'SampleComponent4', contained=False) Relationship(self.zp, 'SampleComponent4', 'SampleComponent5') self.maxDiff = None self.assertEqual([r], Relationship.find(c, contained=True)) self.assertEqual([r3], Relationship.find(c3, contained=False))
def test_ReturnsNoRelationships(self): c2 = self.zp.addComponentType('SampleComponent2') Relationship(self.zp, 'SampleDevice', 'SampleComponent') self.maxDiff = None self.assertEqual([], Relationship.find(c2))
def test_ReturnsNoRelationships(self): c2 = self.zp.addComponentType('SampleComponent2') Relationship(self.zp, 'SampleDevice', 'SampleComponent') self.maxDiff = None self.assertEqual([], Relationship.find(c2))