def testTwoAnnotations(self):
        self.assertTrue(self.client.login(username='jacob', password='JKM'))
        part = self.meeting_1.parts.list()[0]
        res = self.client.post(reverse('annotatetext-post_annotation'),
                        {'selection_start': 7,
                         'selection_end': 14,
                         'flags': 0,
                         'color': '#000',
                         'lengthcheck': len(part.body),
                         'comment' : 'just perfect',
                         'object_id': part.id,
                         'content_type': ContentType.objects.get_for_model(part).id,
                        })
        self.assertEqual(res.status_code, 302)
        res = self.client.post(reverse('annotatetext-post_annotation'),
                        {'selection_start': 8,
                         'selection_end': 15,
                         'flags': 0,
                         'color': '#000',
                         'lengthcheck': len(part.body),
                         'comment' : 'not quite',
                         'object_id': part.id,
                         'content_type': ContentType.objects.get_for_model(part).id,
                        })
        self.assertEqual(res.status_code, 302)

        annotations = Annotation.objects.filter(object_id=part.id,
                         content_type=ContentType.objects.get_for_model(part).id)
        self.assertEqual(annotations.count(), 2)
        # ensure we will see it on the committee page
        c_annotations = self.committee_1.annotations
        self.assertEqual(c_annotations.count(), 2)
        self.assertEqual(c_annotations[0].comment, 'just perfect')
        self.assertEqual(c_annotations[1].comment, 'not quite')
        # test the deletion of an annotation
        annotations[0].delete()
        c_annotations = self.committee_1.annotations
        self.assertEqual(c_annotations.count(), 1)
Record an event.
dataset/ETHPy150Open ofri/Open-Knesset/committees/tests.py/CommitteeMeetingDetailViewTest.testTwoAnnotations--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/watcher/state.py/WatcherState._RecordAttempt