def test_file_valid_mode(self, Image): mock_image = _save_image(mode='ABC') mock_image.convert.assert_called_with('RGB')
def test_file_upload_failure(self): with self.assertRaises(Exception): _save_image(format='MP3')
def test_file_upload_success(self, Image): mock_image = _save_image() self.assertEqual(mock_image.format, 'PNG') mock_image.thumbnail.assert_called_with((140, 140), 1)