def setUp(self): self.maxDiff = None self.member = UserFactory() self.group = GroupFactory(members=[self.member]) self.place = PlaceFactory(group=self.group) self.activity_type = ActivityTypeFactory(group=self.group) self.archived_activity_type = ActivityTypeFactory(group=self.group, status='archived')
def setUp(self): self.url = '/api/activities/' # activity for group with one member and one place self.member = UserFactory() self.group = GroupFactory(members=[self.member]) self.place = PlaceFactory(group=self.group) self.activity_type = ActivityTypeFactory(group=self.group) self.activity = ActivityFactory(activity_type=self.activity_type, place=self.place) # and another place + group + activity self.group2 = GroupFactory(members=[self.member]) self.place2 = PlaceFactory(group=self.group2) self.activity_type2 = ActivityTypeFactory(group=self.group2) self.activity2 = ActivityFactory(activity_type=self.activity_type2, place=self.place2) # an activity series self.series = ActivitySeriesFactory(activity_type=self.activity_type, place=self.place) # another activity series self.series2 = ActivitySeriesFactory(activity_type=self.activity_type, place=self.place)
def setUpTestData(cls): cls.url = '/api/activities/' # activity for group with one member and one place cls.member = UserFactory() cls.second_member = UserFactory() cls.group = GroupFactory(members=[cls.member, cls.second_member]) cls.place = PlaceFactory(group=cls.group) cls.activity_type = ActivityTypeFactory(group=cls.group) cls.archived_activity_type = ActivityTypeFactory(group=cls.group, status='archived') cls.activity = ActivityFactory(activity_type=cls.activity_type, place=cls.place) cls.activity_url = cls.url + str(cls.activity.id) + '/' cls.join_url = cls.activity_url + 'add/' cls.leave_url = cls.activity_url + 'remove/' cls.conversation_url = cls.activity_url + 'conversation/' # not a member of the group cls.user = UserFactory() # another activity for above place cls.activity_data = { 'activity_type': cls.activity_type.id, 'date': to_range(timezone.now() + relativedelta(days=2)).as_list(), 'max_participants': 5, 'place': cls.place.id } # past activity cls.past_activity_data = { 'activity_type': cls.activity_type.id, 'date': to_range(timezone.now() - relativedelta(days=1)).as_list(), 'max_participants': 5, 'place': cls.place.id } cls.past_activity = ActivityFactory( activity_type=cls.activity_type, place=cls.place, date=to_range(timezone.now() - relativedelta(days=1))) cls.past_activity_url = cls.url + str(cls.past_activity.id) + '/' cls.past_join_url = cls.past_activity_url + 'add/' cls.past_leave_url = cls.past_activity_url + 'remove/'
def setUp(self): self.url = '/api/activities/' # activity for group with one member and one place self.member = UserFactory() self.group = GroupFactory(members=[self.member]) self.activity_type = ActivityTypeFactory(group=self.group) self.active_place = PlaceFactory(group=self.group, status='active') self.inactive_place = PlaceFactory(group=self.group, status='created') ActivityFactory(activity_type=self.activity_type, place=self.active_place) ActivityFactory(activity_type=self.activity_type, place=self.inactive_place)
def setUp(self): self.member = UserFactory() self.non_editor_member = UserFactory() self.non_member = UserFactory() self.group = GroupFactory( members=[self.member, self.non_editor_member]) self.place = PlaceFactory(group=self.group) self.activity_types = [ ActivityTypeFactory(group=self.group) for _ in range(3) ] self.activity_type = self.activity_types[0] # remove all roles GroupMembership.objects.filter( group=self.group, user=self.non_editor_member).update(roles=[])
def setUp(self): self.url = '/api/activities/' self.oneWeekAgo = to_range(timezone.now() - relativedelta(weeks=1)) self.tooLongAgo = to_range( timezone.now() - relativedelta(days=settings.FEEDBACK_POSSIBLE_DAYS + 1), minutes=30) self.member = UserFactory() self.member2 = UserFactory() self.group = GroupFactory(members=[self.member, self.member2]) self.place = PlaceFactory(group=self.group) self.activity_type = ActivityTypeFactory(group=self.group) # not member (anymore) self.group2 = GroupFactory(members=[]) self.place2 = PlaceFactory(group=self.group2) self.activity_type2 = ActivityTypeFactory(group=self.group2) self.activityFeedbackPossible = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ], date=self.oneWeekAgo) # now the issues where no feedback can be given self.activityUpcoming = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ]) self.activityNotParticipant = ActivityFactory( activity_type=self.activity_type, place=self.place, date=self.oneWeekAgo) self.activityTooLongAgo = ActivityFactory( activity_type=self.activity_type, place=self.place, date=self.tooLongAgo) self.activityFeedbackAlreadyGiven = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ], date=self.oneWeekAgo) self.feedback = FeedbackFactory( about=self.activityFeedbackAlreadyGiven, given_by=self.member) self.activityParticipantLeftGroup = ActivityFactory( activity_type=self.activity_type2, place=self.place2, participants=[ self.member, ], date=self.oneWeekAgo) self.activityDoneByAnotherUser = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member2, ], date=self.oneWeekAgo) ActivityModel.objects.process_finished_activities()
def setUp(self): self.url = '/api/activities/' self.one_week_ago = to_range(timezone.now() - relativedelta(weeks=1)) self.too_long_ago = to_range( timezone.now() - relativedelta(days=settings.FEEDBACK_POSSIBLE_DAYS + 1), minutes=30) self.member = UserFactory() self.member2 = UserFactory() self.group = GroupFactory(members=[self.member, self.member2]) self.place = PlaceFactory(group=self.group) self.activity_type = ActivityTypeFactory(group=self.group) # not member (anymore) self.group2 = GroupFactory(members=[]) self.place2 = PlaceFactory(group=self.group2) self.activity_type2 = ActivityTypeFactory(group=self.group2) self.activity_feedback_possible = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ], date=self.one_week_ago) # now the issues where no feedback can be given self.activity_upcoming = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ]) self.activity_not_participant = ActivityFactory( activity_type=self.activity_type, place=self.place, date=self.one_week_ago) self.activity_too_long_ago = ActivityFactory( activity_type=self.activity_type, place=self.place, date=self.too_long_ago) self.activity_feedback_already_given = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ], date=self.one_week_ago) self.feedback = FeedbackFactory( about=self.activity_feedback_already_given, given_by=self.member) self.activity_feedback_dismissed = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member, ], date=self.one_week_ago) self.activity_feedback_dismissed.activityparticipant_set.filter( user=self.member).update(feedback_dismissed=True) self.activity_participant_left_group = ActivityFactory( activity_type=self.activity_type2, place=self.place2, participants=[ self.member, ], date=self.one_week_ago) self.activity_done_by_another_user = ActivityFactory( activity_type=self.activity_type, place=self.place, participants=[ self.member2, ], date=self.one_week_ago) ActivityModel.objects.process_finished_activities()
def setUp(self): self.member = UserFactory() self.group = GroupFactory(members=[self.member]) self.place = PlaceFactory(group=self.group) self.place_url = '/api/places/{}/'.format(self.place.id) self.activity_type = ActivityTypeFactory(group=self.group)