def test_delete_remarks_update_cache(self): note = NoteFactory(author=self.user1, document=self.doc, revision=self.revision.revision) self.assertEqual(get_discussion_length(self.revision), 1) note.delete() self.assertEqual(get_discussion_length(self.revision), 0)
def test_delete_remarks_update_cache(self): note = NoteFactory( author=self.user1, document=self.doc, revision=self.revision.revision) self.assertEqual(get_discussion_length(self.revision), 1) note.delete() self.assertEqual(get_discussion_length(self.revision), 0)
def test_new_remarks_update_cache(self): for _ in range(10): NoteFactory( author=self.user1, document=self.doc, revision=self.revision.revision, ) self.assertEqual(get_discussion_length(self.revision), 10)
def test_cancel_review_updates_cache(self): for _ in range(10): NoteFactory( author=self.user1, document=self.doc, revision=self.revision.revision, ) self.revision.cancel_review() self.assertEqual(get_discussion_length(self.revision), 0)
def test_empty_discussion(self): self.assertEqual(get_discussion_length(self.revision), 0)
def discussion_length_badge(revision): length = get_discussion_length(revision) return '<span class="badge">{}</span>'.format(length)
def discussion_length(revision): length = get_discussion_length(revision) return length
def discussion_length_badge(revision): length = get_discussion_length(revision) return format_html('<span class="badge">{}</span>', length)