This commit is contained in:
parent
8c0223a57a
commit
27d029350a
@ -390,7 +390,7 @@ class TestRenderableFormField(unittest.TestCase):
|
||||
mock_draw.rectangle.assert_called_once() # Field background
|
||||
|
||||
|
||||
""" TODO: Fix test
|
||||
|
||||
@patch('PIL.ImageDraw.Draw')
|
||||
def test_render_field_with_value(self, mock_draw_class):
|
||||
#Test rendering field with value
|
||||
@ -402,7 +402,7 @@ class TestRenderableFormField(unittest.TestCase):
|
||||
|
||||
with patch.object(renderable._label_text, 'render') as mock_label_render:
|
||||
mock_label_render.return_value = Image.new('RGBA', (60, 16), (255, 255, 255, 255))
|
||||
with patch('pyWebLayout.concrete.text.Text') as mock_text_class:
|
||||
with patch('pyWebLayout.concrete.functional.Text') as mock_text_class:
|
||||
mock_text_obj = Mock()
|
||||
mock_text_obj.render.return_value = Image.new('RGBA', (60, 16), (255, 255, 255, 255))
|
||||
mock_text_class.return_value = mock_text_obj
|
||||
@ -412,7 +412,7 @@ class TestRenderableFormField(unittest.TestCase):
|
||||
self.assertIsInstance(result, Image.Image)
|
||||
mock_label_render.assert_called_once()
|
||||
mock_text_class.assert_called() # Value text should be created
|
||||
"""
|
||||
|
||||
|
||||
@patch('PIL.ImageDraw.Draw')
|
||||
def test_render_password_field(self, mock_draw_class):
|
||||
@ -425,7 +425,7 @@ class TestRenderableFormField(unittest.TestCase):
|
||||
|
||||
with patch.object(renderable._label_text, 'render') as mock_label_render:
|
||||
mock_label_render.return_value = Image.new('RGBA', (60, 16), (255, 255, 255, 255))
|
||||
with patch('pyWebLayout.concrete.text.Text') as mock_text_class:
|
||||
with patch('pyWebLayout.concrete.functional.Text') as mock_text_class:
|
||||
mock_text_obj = Mock()
|
||||
mock_text_obj.render.return_value = Image.new('RGBA', (60, 16), (255, 255, 255, 255))
|
||||
mock_text_class.return_value = mock_text_obj
|
||||
@ -434,8 +434,8 @@ class TestRenderableFormField(unittest.TestCase):
|
||||
|
||||
self.assertIsInstance(result, Image.Image)
|
||||
# Check that Text was called with masked characters
|
||||
if mock_text_class.call_args:
|
||||
self.assertEqual(args[0], "•" * len("secret123"))
|
||||
mock_text_class.assert_called()
|
||||
self.assertEqual(mock_text_class.call_args[0][0], "•" * len("secret123"))
|
||||
|
||||
@patch('PIL.ImageDraw.Draw')
|
||||
def test_render_focused_field(self, mock_draw_class):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user