예제 #1
0
    def test_resize_no_upscaling(self):
        """
        Ensure upscaling is forbidden in resize action.
        """
        renderer = LazyThumbRenderer()
        mock_img = MockImg()
        img = renderer.resize(width=2000, height=2000, img=mock_img)

        self.assertEqual(img.size[0], 1000)
        self.assertEqual(img.size[1], 1000)
        self.assertEqual(len(mock_img.called), 0)
예제 #2
0
 def test_resize(self):
     """
     Test behavior of resize action.
     """
     renderer = LazyThumbRenderer()
     mock_img = MockImg()
     img = renderer.resize(width=48, height=50, img=mock_img)
     self.assertEqual(img.size[1], 50)
     self.assertEqual(len(mock_img.called), 2)
     self.assertTrue('crop' in mock_img.called)
     self.assertTrue('resize' in mock_img.called)