def test_complete_content(self): from attachments import complete_content complete = complete_content(self.p1,content_field='text') ref = u''.join(( u"Post 1's text\n\n", u".. ################################################################################\n", u" The following lines are automatically inserted to access attachments.\n", u" ################################################################################\n", u"\n", u".. |Image1| image:: attachments/cache/foo_scaled.png\n", u" :alt: Image1\n", u" :class: left\n", u".. _Image1: foo.png\n\n\n", )) self.assertEqual(complete,ref)
def complete_content(obj,content_field='content'): return mark_safe(attachments.complete_content(obj, content_field))