mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
split up tests for RichText() and RichTextBlock.get_default()
This commit is contained in:
parent
1c510a04c8
commit
9a864ff6c9
@ -110,23 +110,27 @@ class TestFieldBlock(unittest.TestCase):
|
||||
class TestRichTextBlock(TestCase):
|
||||
fixtures = ['test.json']
|
||||
|
||||
def test_get_default(self):
|
||||
def test_get_default_with_fallback_value(self):
|
||||
default_value = blocks.RichTextBlock().get_default()
|
||||
self.assertTrue(isinstance(default_value, RichText))
|
||||
self.assertEqual(default_value.source, '')
|
||||
|
||||
def test_get_default_with_default_none(self):
|
||||
default_value = blocks.RichTextBlock(default=None).get_default()
|
||||
self.assertTrue(isinstance(default_value, RichText))
|
||||
self.assertEqual(default_value.source, '')
|
||||
|
||||
def test_get_default_with_empty_string(self):
|
||||
default_value = blocks.RichTextBlock(default='').get_default()
|
||||
self.assertTrue(isinstance(default_value, RichText))
|
||||
self.assertEqual(default_value.source, '')
|
||||
|
||||
def test_get_default_with_nonempty_string(self):
|
||||
default_value = blocks.RichTextBlock(default='<p>foo</p>').get_default()
|
||||
self.assertTrue(isinstance(default_value, RichText))
|
||||
self.assertEqual(default_value.source, '<p>foo</p>')
|
||||
|
||||
def test_get_default_with_richtext_value(self):
|
||||
default_value = blocks.RichTextBlock(default=RichText('<p>foo</p>')).get_default()
|
||||
self.assertTrue(isinstance(default_value, RichText))
|
||||
self.assertEqual(default_value.source, '<p>foo</p>')
|
||||
|
@ -121,13 +121,15 @@ class TestExpandDbHtml(TestCase):
|
||||
class TestRichTextValue(TestCase):
|
||||
fixtures = ['test.json']
|
||||
|
||||
def test_construct(self):
|
||||
def test_construct_with_none(self):
|
||||
value = RichText(None)
|
||||
self.assertEqual(value.source, '')
|
||||
|
||||
def test_construct_with_empty_string(self):
|
||||
value = RichText('')
|
||||
self.assertEqual(value.source, '')
|
||||
|
||||
def test_construct_with_nonempty_string(self):
|
||||
value = RichText('<p>hello world</p>')
|
||||
self.assertEqual(value.source, '<p>hello world</p>')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user