def test_image_set_url(self):
     image = Image(URL)
     image.set_url("www.qwerty.com/image.bmp")
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": "www.qwerty.com/image.bmp"
     })
 def test_image(self):
     image = Image(URL, alternate_text="Ut enim ad minim veniam", background_color="0f0f0f", height="50px",
                   horizontal_alignment=HorizontalAlignment.LEFT, select_action=OpenUrl("www.sample.com"),
                   size=ImageSize.SMALL, style=ImageStyle.PERSON, width="100px", fallback=FallbackOption.DROP,
                   separator=True, spacing=SpacingStyle.SMALL, item_id="id_image", is_visible=True,
                   requires=self.requires)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "altText": "Ut enim ad minim veniam",
         "backgroundColor": "0f0f0f",
         "height": "50px",
         "horizontalAlignment": "left",
         "selectAction": {
             "type": "Action.OpenUrl",
             "url": "www.sample.com"
         },
         "size": "small",
         "style": "person",
         "width": "100px",
         "fallback": "drop",
         "separator": True,
         "spacing": "small",
         "id": "id_image",
         "isVisible": True,
         "requires": self.requires
     })
 def test_image_set_requires(self):
     image = Image(URL)
     image.set_requires(self.requires)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "requires": self.requires
     })
 def test_image_set_id(self):
     image = Image(URL)
     image.set_id("id_image_3")
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "id": "id_image_3"
     })
 def test_image_set_spacing(self):
     image = Image(URL)
     image.set_spacing(SpacingStyle.EXTRA_LARGE)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "spacing": "extraLarge"
     })
 def test_image_set_width(self):
     image = Image(URL)
     image.set_width("128px")
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "width": "128px"
     })
 def test_image_set_style(self):
     image = Image(URL)
     image.set_style(ImageStyle.DEFAULT)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "style": "default"
     })
 def test_image_set_size(self):
     image = Image(URL)
     image.set_size(ImageSize.LARGE)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "size": "large"
     })
 def test_image_set_horizontal_alignment(self):
     image = Image(URL)
     image.set_horizontal_alignment(HorizontalAlignment.RIGHT)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "horizontalAlignment": "right"
     })
 def test_image_set_background_color(self):
     image = Image(URL)
     image.set_background_color("abcdef")
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "backgroundColor": "abcdef"
     })
 def test_image_set_alternate_text(self):
     image = Image(URL)
     image.set_alternate_text("Duis aute irure")
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "altText": "Duis aute irure"
     })
 def test_image_set_fallback(self):
     image = Image(URL)
     image.set_fallback(FallbackOption.DROP)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "fallback": "drop"
     })
     image.set_fallback(Image(URL))
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "fallback": {
             "type": "Image",
             "url": URL
         }
     })
     with self.assertRaisesMessage(CardException, "Invalid fallback type"):
         image.set_fallback(1234)
 def test_image_set_is_visible(self):
     image = Image(URL)
     image.set_is_visible(False)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "isVisible": False
     })
     image.set_is_visible(True)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "isVisible": True
     })
     image.set_is_visible()
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "isVisible": True
     })
 def test_image_set_separator(self):
     image = Image(URL)
     image.set_separator(False)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "separator": False
     })
     image.set_separator(True)
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "separator": True
     })
     image.set_separator()
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "separator": True
     })
 def test_image_set_select_action(self):
     image = Image(URL)
     image.set_select_action(OpenUrl("www.click.me"))
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "selectAction": {
             "type": "Action.OpenUrl",
             "url": "www.click.me"
         }
     })
 def test_image_set_height(self):
     image = Image(URL)
     image.set_height("42px")
     self.assertDictEqual(image.as_data(), {
         "type": "Image",
         "url": URL,
         "height": "42px"
     })
     image.set_height(BlockElementHeight.STRETCH)
     with self.assertRaisesMessage(CardException, "Invalid height type"):
         image.set_height(1234)