def _build_digest_thread(thread_id, course_id, thread_content): """ Parses a thread information for the given course and thread. """ return DigestThread(thread_id, course_id, thread_content["commentable_id"], thread_content["title"], [ _build_digest_item(item_dict) for item_dict in thread_content["content"] ])
def _test_unicode_data(self, input_text, expected_text, expected_html=None): user = { "id": "0", "username": "******", } digest = Digest([ DigestCourse(TEST_COURSE_ID, [ DigestThread("0", TEST_COURSE_ID, TEST_COMMENTABLE, input_text, [DigestItem("test content", None, None)]) ]) ]) (rendered_text, rendered_html) = render_digest(user, digest, "Test Title", "Test Description") self.assertIn(expected_text, rendered_text) self.assertIn(expected_html if expected_html else expected_text, rendered_html)
def thread(thread_id, course_id, thread_dict): return DigestThread( thread_id, course_id, thread_dict["commentable_id"], thread_dict["title"], [Parser.item(item_dict) for item_dict in thread_dict["content"]])
def _test_unicode_data(self, input_text, expected_text): self.assertEqual( DigestThread("0", TEST_COURSE_ID, TEST_COMMENTABLE, input_text, []).title, expected_text)