def test_suggestion_entry_without_category(self): crid = '1011111' allegation = AllegationFactory(crid=crid) OfficerAllegationFactory(allegation=allegation, cat=None) expected_entry = { 'text': crid, 'resource': 'officer_allegation', 'resource_key': crid, 'meta': { 'allegation': allegation } } allegation.as_suggestion_entry().should.be.equal(expected_entry)
def test_suggestion_entry_without_category(self): crid = '1011111' allegation = AllegationFactory(crid=crid) OfficerAllegationFactory(allegation=allegation, cat=None) expected_entry = { 'text': crid, 'resource': 'officer_allegation', 'resource_key': crid, 'meta': { 'allegation': allegation } } allegation.as_suggestion_entry().should.be.equal(expected_entry)
def test_suggest_crid(self): allegation = AllegationFactory(crid='1051333') OfficerAllegationFactory(allegation=allegation) OfficerAllegationFactory(allegation=AllegationFactory(crid='306697')) crid = str(allegation.crid) partial_query = crid[0:3] suggest_crid(partial_query).should.equal([]) expected_allegation = allegation.as_suggestion_entry() allegation_result = suggest_crid(crid) allegation_result[0]['meta']['allegation'].incident_date = \ allegation_result[0]['meta']['allegation'].incident_date.date() allegation_result.should.equal([expected_allegation])
def test_suggest_crid(self): allegation = AllegationFactory(crid='1051333') OfficerAllegationFactory(allegation=allegation) OfficerAllegationFactory(allegation=AllegationFactory(crid='306697')) crid = str(allegation.crid) partial_query = crid[0:3] suggest_crid(partial_query).should.equal([]) expected_allegation = allegation.as_suggestion_entry() allegation_result = suggest_crid(crid) allegation_result[0]['meta']['allegation'].incident_date = \ allegation_result[0]['meta']['allegation'].incident_date.date() allegation_result.should.equal([expected_allegation])