Example #1
0
    def test_detail(self):
        image_detail = ImageUtils.get_image_dimensions(None, self.path)

        # test if we have an ImageDetails instance
        self.assertTrue(isinstance(image_detail, ImageDetails))

        # test image_detail attribute
        for k, v in list(self.expected_results.items()):
            self.assertEqual(getattr(image_detail, k), v)

        # test image_detail get_ methode
        for k, v in list(self.expected_results.items()):
            attr = 'get_%s' % k
            self.assertEqual(getattr(image_detail, attr)(), v)

        # test image_detail set_ methode
        expected_results = {
            'width': 10,
            'height': 10,
            'mime_type': 'PNG'
        }

        for k, v in list(expected_results.items()):
            attr = 'set_%s' % k
            getattr(image_detail, attr)(v)

        for k, v in list(expected_results.items()):
            attr = 'get_%s' % k
            self.assertEqual(getattr(image_detail, attr)(), v)
Example #2
0
    def test_utils_get_image_dimensions(self):
        image_detail = ImageUtils.get_image_dimensions(None, self.path)

        # test if we have an ImageDetails instance
        self.assertTrue(isinstance(image_detail, ImageDetails))

        # test image_detail attribute
        for k, v in list(self.expected_results.items()):
            self.assertEqual(getattr(image_detail, k), v)