Example #1
0
 def it_should_have_relative_ref_for_internal_rel(self):
     """
     Internal relationships (TargetMode == 'Internal' in the XML) should
     have a relative ref, e.g. '../slideLayouts/slideLayout1.xml', for
     the target_ref attribute.
     """
     part = Mock(name='part', partname=PackURI('/ppt/media/image1.png'))
     baseURI = '/ppt/slides'
     rel = _Relationship(None, None, part, baseURI)  # external=False
     assert rel.target_ref == '../media/image1.png'
Example #2
0
 def it_remembers_construction_values(self):
     # test data --------------------
     rId = 'rId9'
     reltype = 'reltype'
     target = Mock(name='target_part')
     external = False
     # exercise ---------------------
     rel = _Relationship(rId, reltype, target, None, external)
     # verify -----------------------
     assert rel.rId == rId
     assert rel.reltype == reltype
     assert rel.target_part == target
     assert rel.is_external == external
Example #3
0
 def it_should_have_target_ref_for_external_rel(self):
     rel = _Relationship(None, None, 'target', None, external=True)
     assert rel.target_ref == 'target'
Example #4
0
 def it_should_raise_on_target_part_access_on_external_rel(self):
     rel = _Relationship(None, None, None, None, external=True)
     with pytest.raises(ValueError):
         rel.target_part
Example #5
0
 def _rel_with_target_known_by_reltype(
         self, _rId, _reltype, _target_part, _baseURI):
     rel = _Relationship(_rId, _reltype, _target_part, _baseURI)
     return rel, _reltype, _target_part
Example #6
0
 def rel(self, _rId, _reltype, _target_part, _baseURI):
     return _Relationship(_rId, _reltype, _target_part, _baseURI)
Example #7
0
 def _rel_with_target_known_by_reltype(
         self, _rId, _reltype, _target_part, _baseURI):
     rel = _Relationship(_rId, _reltype, _target_part, _baseURI)
     return rel, _reltype, _target_part
Example #8
0
 def rel(self, _rId, _reltype, _target_part, _baseURI):
     return _Relationship(_rId, _reltype, _target_part, _baseURI)