kopia lustrzana https://github.com/wagtail/wagtail
Fixed `ValueError` not raised (#5095)
Raised `ValueError` in `wagtail/images/utils.py` that was called but not raised I work for Semmle and I noticed these issues using our LGTM code analyzer https://lgtm.com/projects/g/wagtail/wagtail/alerts/?mode=tree&severity=error&ruleFocus=1505923886371pull/5109/head
rodzic
234ee703ed
commit
20f47ff50e
|
@ -347,6 +347,7 @@ Contributors
|
|||
* Vladimir Knobel
|
||||
* Matt Collins
|
||||
* Thomas Elliott
|
||||
* damianosSemmle
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
@ -619,3 +619,11 @@ class TestBackgroundColorFilter(TestCase):
|
|||
file=get_test_image_file(),
|
||||
)
|
||||
self.assertRaises(ValueError, fil.run, image, BytesIO())
|
||||
|
||||
def test_invalid_length(self):
|
||||
fil = Filter(spec='width-400|bgcolor-1234')
|
||||
image = Image.objects.create(
|
||||
title="Test image",
|
||||
file=get_test_image_file(),
|
||||
)
|
||||
self.assertRaises(ValueError, fil.run, image, BytesIO())
|
||||
|
|
|
@ -57,6 +57,6 @@ def parse_color_string(color_string):
|
|||
g = int(color_string[2:4], 16)
|
||||
b = int(color_string[4:6], 16)
|
||||
else:
|
||||
ValueError('Color string must be either 3 or 6 hexadecimal digits long')
|
||||
raise ValueError('Color string must be either 3 or 6 hexadecimal digits long')
|
||||
|
||||
return r, g, b
|
||||
|
|
Ładowanie…
Reference in New Issue