Ejemplo n.º 1
0
 def target_ref_fixture_(self, request, part):
     rId = 'rId246'
     url = 'https://github.com/scanny/python-docx'
     rels = Relationships(None)
     rels.add_relationship(None, url, rId, is_external=True)
     part._rels = rels
     return part, rId, url
Ejemplo n.º 2
0
 def target_ref_fixture_(self, request, part):
     rId = 'rId246'
     url = 'https://github.com/scanny/python-docx'
     rels = Relationships(None)
     rels.add_relationship(None, url, rId, is_external=True)
     part._rels = rels
     return part, rId, url
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 def it_can_add_a_relationship(self, _Relationship_):
     baseURI, rId, reltype, target, is_external = ('baseURI', 'rId9',
                                                   'reltype', 'target',
                                                   False)
     rels = Relationships(baseURI)
     rel = rels.add_relationship(reltype, target, rId, is_external)
     _Relationship_.assert_called_once_with(rId, reltype, target, baseURI,
                                            is_external)
     assert rels[rId] == rel
     assert rel == _Relationship_.return_value
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 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