Exemplo n.º 1
0
 def test_serializing_minimal_image(self):
     """
     Check if image with minimal properties will serialize properly
     """
     expected = {
         'src': 'http://www.example.com',
     }
     image = Image(**expected)
     expected['type'] = 'image'
     self.assertEqual(expected, image.to_dict())
Exemplo n.º 2
0
 def test_serializing_maximum_image(self):
     """
     Check if image with maximum properties will serialize properly
     """
     expected = {
         'alt': 'This is image',
         'href': 'http://www.example.com/href',
         'src': 'http://www.example.com',
     }
     image = Image(**expected)
     expected['type'] = 'image'
     self.assertEqual(expected, image.to_dict())
Exemplo n.º 3
0
 def test_instantiating_minimal_image(self):
     """
     Check if image with minimal properties will work
     """
     img_src = 'http://www.example.com'
     image = Image(src=img_src)
     self.assertEqual('image', image.type)
     self.assertEqual(img_src, image.src)
Exemplo n.º 4
0
 def test_instantiating_maximum_image(self):
     """
     Check if image with maximum properties will work
     """
     img_src = 'http://www.example.com'
     img_href = '{}/href'.format(img_src)
     img_alt = 'This is image'
     image = Image(src=img_src, href=img_href, alt=img_alt)
     self.assertEqual('image', image.type)
     self.assertEqual(img_src, image.src)
     self.assertEqual(img_href, image.href)
     self.assertEqual(img_alt, image.alt)