-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_blocks.py
More file actions
27 lines (22 loc) · 869 Bytes
/
test_blocks.py
File metadata and controls
27 lines (22 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.test import TestCase
from common.blocks import AlignedCaptionedImageBlock
class AlignedCaptionedImageBlockGetContextTest(TestCase):
def test_get_context_with_content_warning_unwraps_first_item(self):
warning_text = "This image may be disturbing."
block = AlignedCaptionedImageBlock()
value = block.to_python(
{
"content_warning": [warning_text],
}
)
block.get_context(value)
self.assertEqual(value["content_warning"], warning_text)
def test_get_context_without_content_warning_leaves_value_unchanged(self):
block = AlignedCaptionedImageBlock()
value = block.to_python(
{
"content_warning": [],
}
)
block.get_context(value)
self.assertEqual(list(value["content_warning"]), [])