def test_can_save_both_raw_and_rendered_data(self):
     # Run & check
     for bbcodes_text, expected_html_text in self.BBCODE_FIELDS_TESTS:
         message = TestMessage()
         message.content = bbcodes_text
         message.save()
         self.assertEqual(message.content.rendered, expected_html_text)
 def test_accepts_none_values(self):
     # Setup
     message = TestMessage()
     message.content = None
     # Run
     message.save()
     # Check
     self.assertIsNone(message.content)
     rendered = hasattr(message.content, 'rendered')
     self.assertFalse(rendered)
 def test_uses_a_valid_descriptor_protocol(self):
     # Setup
     message = TestMessage()
     message.content = None
     message.save()
     bbcode_content = BBCodeContent('[b]hello world![/b]')
     # Run
     message.content = bbcode_content
     message.save()
     # Check
     self.assertEqual(message.content.rendered, '<strong>hello world!</strong>')