コード例 #1
0
    def test_update_allegation_summary_not_update_if_do_not_have_text_content(
            self):
        allegation = AllegationFactory(summary='')
        attachment_file = AttachmentFileFactory(
            source_type=AttachmentSourceType.
            SUMMARY_REPORTS_COPA_DOCUMENTCLOUD,
            text_content='',
            allegation=allegation,
        )

        expect(attachment_file.update_allegation_summary()).to.be.false()

        expect(allegation.summary).to.eq('')
        expect(allegation.is_extracted_summary).to.be.false()
コード例 #2
0
    def test_update_allegation_summary_not_update_if_can_not_parse_summary_from_text_content(
            self):
        text_content = 'This is invalid text content.'
        allegation = AllegationFactory(summary='')
        attachment_file = AttachmentFileFactory(
            source_type=AttachmentSourceType.
            SUMMARY_REPORTS_COPA_DOCUMENTCLOUD,
            text_content=text_content,
            allegation=allegation,
        )

        expect(attachment_file.update_allegation_summary()).to.be.false()

        expect(allegation.summary).to.eq('')
        expect(allegation.is_extracted_summary).to.be.false()
コード例 #3
0
    def test_update_allegation_summary_not_update_if_allegation_already_has_summary(
            self):
        text_content = \
            'CIVILIAN OFFICE OF POLICE ACCOUNTABILITY ' \
            '\nSUMMARY REPORT OF INVESTIGATION1' \
            '\nI. EXECUTIVE SUMMARY' \
            '\nDate of Incident: September 25, 2015' \
            '\nTime of Incident: 8:53 pm.' \
            '\nLocation of Incident: N. Central Park Avenue, Chicago, IL' \
            '\nDate of COPA Notification: September 25, 2015' \
            '\nTime of COPA Notification: 9:15 pm.' \
            '\nOn September 25, 2015, at approximately 8:50 pm, Officers A and responded to a' \
            '\ncall of a disturbance with a mentally ill subject, Involved Civilian 1 (Involved Civilian 1), at ' \
            '\nN. Central Park Avenue, Chicago, IL. Upon arrival, the officers met with Involved Civilian' \
            '\nmother, Involved Civilian 2 (Involved Civilian 2), who stated that Involved Civilian 1 was acting' \
            '\ncrazy, had a knife, and would not come out of his bedroom. Officers A and B, along with assisting' \
            '\nOfficers and D, entered the residence and knocked on Involved Civilian bedroom door.' \
            '\nInvolved Civilian 1 opened the bedroom door while holding a knife in his hand. The officers' \
            '\nordered Involved Civilian 1 to drop the knife, but he did not comply. Involved Civilian 1 exited' \
            '\nhis bedroom and approached Officer A as he stood in the kitchen, which was adjacent to the' \
            '\nbedroom. Officer attempted to tase Involved Civilian 1, but the Taser did not appear to have any' \
            '\neffect on Involved Civilian 1. Involved Civilian 1 continued to approach Officer A, while still' \
            '\nholding the knife in his hand, at which time Officer A discharged his firearm five times, striking' \
            '\nInvolved Civilian 1 several times about the body. Involved Civilian 1 was declared dead at 2133' \
            '\nhours at Mt. Sinai hospital. investigation demonstrates that Officer use of deadly' \
            '\nforce complied with Chicago Police Department rules and directives.' \
            '\nII. INVOLVED PARTIES' \
            '\nInvolved Officer Officer A, star Employee Date of' \
            '\nAppointment: Chicago Police Officer, Unit of' \
            '\nAssignment: XX, DOB: 1983, Male White.' \
            '\nInvolved Individual#1: Involved Civilian 1, DOB: 1982, Male, Black.' \
            '\n1 On September 15, 2017, the Civilian Office of Police Accountability (COPA) replaced the ' \
            '\nIndependent Police' \

        allegation = AllegationFactory(
            summary='This allegation already has summary.')
        attachment_file = AttachmentFileFactory(
            source_type=AttachmentSourceType.
            SUMMARY_REPORTS_COPA_DOCUMENTCLOUD,
            text_content=text_content,
            allegation=allegation,
        )

        expect(attachment_file.update_allegation_summary()).to.be.false()

        expect(
            allegation.summary).to.eq('This allegation already has summary.')
        expect(allegation.is_extracted_summary).to.be.false()