def it_can_add_a_relationship(self, _Relationship_):
     baseURI, rId, reltype, target, external = (
         'baseURI', 'rId9', 'reltype', 'target', False
     )
     rels = Relationships(baseURI)
     rel = rels.add_relationship(reltype, target, rId, external)
     _Relationship_.assert_called_once_with(
         rId, reltype, target, baseURI, external
     )
     assert rels[rId] == rel
     assert rel == _Relationship_.return_value
 def rels_with_rId_gap(self, request):
     rels = Relationships(None)
     rel_with_rId1 = instance_mock(
         request, _Relationship, name='rel_with_rId1', rId='rId1'
     )
     rel_with_rId3 = instance_mock(
         request, _Relationship, name='rel_with_rId3', rId='rId3'
     )
     rels['rId1'] = rel_with_rId1
     rels['rId3'] = rel_with_rId3
     return rels, 'rId2'
 def rels(self):
     """
     Populated Relationships instance that will exercise the rels.xml
     property.
     """
     rels = Relationships('/baseURI')
     rels.add_relationship(
         reltype='http://rt-hyperlink', target='http://some/link',
         rId='rId1', is_external=True
     )
     part = Mock(name='part')
     part.partname.relative_ref.return_value = '../media/image1.png'
     rels.add_relationship(reltype='http://rt-image', target=part,
                           rId='rId2')
     return rels
 def build(self):
     rels = Relationships()
     for rel in self.relationships:
         rels.add_rel(rel)
     return rels
 def it_can_find_a_relationship_by_rId(self):
     rel = Mock(name='rel', rId='foobar')
     rels = Relationships(None)
     rels['foobar'] = rel
     assert rels['foobar'] == rel
 def add_matching_ext_rel_fixture_(self, request, reltype, url):
     rId = 'rId369'
     rels = Relationships(None)
     rels.add_relationship(reltype, url, rId, is_external=True)
     return rels, reltype, url, rId
 def add_ext_rel_fixture_(self, reltype, url):
     rels = Relationships(None)
     return rels, reltype, url
 def rels(self):
     """
     Return a reference to the |Relationships| instance holding the
     collection of relationships for this package.
     """
     return Relationships(PACKAGE_URI.baseURI)
 def rels(self):
     """
     |Relationships| instance holding the relationships for this part.
     """
     return Relationships(self._partname.baseURI)