Beispiel #1
0
    def it_can_get_a_related_image_by_rId(self, request, image_part_):
        image_ = instance_mock(request, Image)
        image_part_.image = image_
        related_part_ = method_mock(
            request, BaseSlidePart, "related_part", return_value=image_part_
        )
        slide_part = BaseSlidePart(None, None, None, None)

        image = slide_part.get_image("rId42")

        related_part_.assert_called_once_with(slide_part, "rId42")
        assert image is image_
Beispiel #2
0
    def it_can_add_an_image_part(self, request, image_part_):
        package_ = instance_mock(request, Package)
        package_.get_or_add_image_part.return_value = image_part_
        relate_to_ = method_mock(
            request, BaseSlidePart, "relate_to", return_value="rId6"
        )
        slide_part = BaseSlidePart(None, None, package_, None)

        image_part, rId = slide_part.get_or_add_image_part("foobar.png")

        package_.get_or_add_image_part.assert_called_once_with("foobar.png")
        relate_to_.assert_called_once_with(slide_part, image_part_, RT.IMAGE)
        assert image_part is image_part_
        assert rId == "rId6"
Beispiel #3
0
 def image_part_fixture(
         self, partname_, package_, image_part_, relate_to_):
     slide = BaseSlidePart(partname_, None, None, package_)
     image_file, rId = 'foobar.png', 'rId6'
     package_.get_or_add_image_part.return_value = image_part_
     relate_to_.return_value = rId
     return slide, image_file, image_part_, rId
 def name_fixture(self):
     sld_cxml, expected_value = "p:sld/p:cSld{name=Foobar}", "Foobar"
     sld = element(sld_cxml)
     base_slide = BaseSlidePart(None, None, sld, None)
     return base_slide, expected_value
 def get_image_fixture(self, related_parts_prop_, image_part_, image_):
     slide = BaseSlidePart(None, None, None, None)
     rId = "rId42"
     related_parts_prop_.return_value = {rId: image_part_}
     image_part_.image = image_
     return slide, rId, image_
Beispiel #6
0
 def it_knows_its_name(self):
     slide_part = BaseSlidePart(
         None, None, None, element("p:sld/p:cSld{name=Foobar}")
     )
     assert slide_part.name == "Foobar"