def setUp(self): super(BulletinTestCase, self).setUp() self.test_user_util = TestUserUtility() self.user = self.test_user_util.user self.location = Location(name_en='test location', loc_type='Village') self.location.save() self.actor = Actor(fullname_en='Test Actor', fullname_ar='Test name ar', nickname_en='nick name', nickname_ar='nick name') self.actor.save() self.role = ActorRole(role_status='Detained', actor_id=self.actor.pk) self.role.save() self.sourceType = SourceType(source_type='test source type', description='test source description') self.sourceType.save() self.source = Source(reliability_score=0, name_en='test source', source_type_id=self.sourceType.pk) self.source.save() self.source = Source(reliability_score=0, name_en='test source 2', source_type_id=self.sourceType.pk) self.source.save() self.label = Label(name_en='test label') self.label.save() self.comment = Comment(assigned_user_id=self.user.pk, status_id=3, comments_en='test comment') self.comment.save() self.media = Media(media_type='Video', name_en='test media', media_file='') self.media.save() fixture = AutoFixture(Bulletin, generate_m2m={1, 5}) fixture.create(10) try: self.api_key = ApiKey.objects.get(user=self.user) except ApiKey.DoesNotExist: self.api_key = ApiKey.objects.create(user=self.user) self.auth_string = '&username={0}&api_key={1}'.format( self.user.username, self.api_key.key)
def setUp(self): super(IncidentTestCase, self).setUp() self.test_user_util = TestUserUtility() self.user = self.test_user_util.user self.location = Location(name_en='test location', loc_type='Village') self.location.save() self.actor = Actor( fullname_en='Test Actor', fullname_ar='Test name ar', nickname_en='nick name', nickname_ar='nick name') self.actor.save() self.role = ActorRole(role_status='Detained', actor_id=self.actor.pk) self.role.save() self.statusUpdate = StatusUpdate(status_en='test status') self.statusUpdate.save() self.crimeCategory = CrimeCategory( name_en='test crime category', level=1, description_en='test source incident_details') self.crimeCategory.save() self.label = Label(name_en='test label') self.label.save() self.comment = Comment( assigned_user_id=self.user.pk, status_id=self.statusUpdate.pk, comments_en='test comment') self.comment.save() fixture = AutoFixture(Incident, generate_m2m={1, 5}) fixture.create(10) try: self.api_key = ApiKey.objects.get(user=self.user) except ApiKey.DoesNotExist: self.api_key = ApiKey.objects.create(user=self.user) self.auth_string = '&username={0}&api_key={1}'.format( self.user.username, self.api_key.key)