def test_filter_by_has_map(self): data = self.fetch_officer_allegations(has_map='true') len(data).should.equal(3) allegation = AllegationFactory() allegation.point = None allegation.save() OfficerAllegationFactory(allegation=allegation) data = self.fetch_officer_allegations(has_map='true') len(data).should.equal(3) for i in range(3): data[i]['allegation']['id'].shouldnt.equal(allegation.id)
def test_query_area_type(self): self.clean_db() area = AreaFactory(type='school-grounds') allegation = AllegationFactory() allegation.areas = [area] allegation.save() other_allegation = AllegationFactory() other_allegation.areas = [AreaFactory(type='beat')] other_allegation.save() oa1 = OfficerAllegationFactory(allegation=allegation) OfficerAllegationFactory(allegation=other_allegation) self.check_built_query('allegation__areas__type=school-grounds', [oa1.id])