Exemple #1
0
 def test_copy_only_area(self):
     area_context = StaffAreaContext()
     conf_day = ConferenceDayFactory(conference=area_context.conference)
     another_day = ConferenceDayFactory()
     another_room = RoomFactory()
     another_room.conferences.add(another_day.conference)
     data = {
         'pick_mode': "Next",
         'copy_to_day': another_day.pk,
         'room': another_room.room.pk,
     }
     self.url = reverse(self.view_name,
                        args=[area_context.area.pk],
                        urlconf='gbe.scheduling.urls')
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=data, follow=True)
     redirect_url = "%s?%s-day=%d&filter=Filter&new=%s" % (
         reverse('manage_event_list',
                 urlconf='gbe.scheduling.urls',
                 args=[another_day.conference.conference_slug
                       ]), another_day.conference.conference_slug,
         another_day.pk, str([area_context.area.pk + 1]))
     self.assertRedirects(response, redirect_url)
     assert_alert_exists(
         response, 'success', 'Success',
         'A new Staff Area was created.<br>Staff Area: %s' %
         (area_context.area.title))
    def add_volunteer_opp(self, volunteer_sched_event=None, room=None):
        if not self.conference.conferenceday_set.exists():
            if volunteer_sched_event:
                self.conf_day = ConferenceDayFactory(
                    day=volunteer_sched_event.starttime.date(),
                    conference=self.conference)
            else:
                self.conf_day = ConferenceDayFactory(
                    conference=self.conference)
        else:
            self.conf_day = self.conference.conferenceday_set.first()
        if not volunteer_sched_event:
            vol_event = GenericEventFactory(e_conference=self.conference,
                                            type="Volunteer")
            volunteer_sched_event = SchedEventFactory(
                eventitem=vol_event,
                max_volunteer=self.area.default_volunteers,
                starttime=noon(self.conf_day))
        if not room:
            room = RoomFactory()

        ResourceAllocationFactory(event=volunteer_sched_event,
                                  resource=LocationFactory(_item=room))
        EventLabelFactory(event=volunteer_sched_event, text=self.area.slug)
        EventLabelFactory(event=volunteer_sched_event,
                          text=self.conference.conference_slug)
        EventLabelFactory(event=volunteer_sched_event, text="Volunteer")
        return volunteer_sched_event
    def __init__(self,
                 bid=None,
                 teacher=None,
                 conference=None,
                 room=None,
                 starttime=None):
        self.teacher = teacher or PersonaFactory()
        self.conference = conference or ConferenceFactory()
        if not self.conference.conferenceday_set.exists():
            day = ConferenceDayFactory(conference=self.conference)
            if starttime:
                day.day = starttime.date()
                day.save()

        self.days = self.conference.conferenceday_set.all()
        self.starttime = starttime or noon(self.days[0])
        self.bid = bid or ClassFactory(b_conference=self.conference,
                                       e_conference=self.conference,
                                       accepted=3,
                                       teacher=self.teacher,
                                       submitted=True)
        self.room = room or RoomFactory()
        self.room.conferences.add(self.conference)
        self.sched_event = None
        self.sched_event = self.schedule_instance(room=self.room,
                                                  starttime=starttime)
Exemple #4
0
 def __init__(self,
              act=None,
              performer=None,
              conference=None,
              room=None,
              starttime=None,
              act_role=''):
     self.performer = performer or PersonaFactory()
     self.conference = conference or ConferenceFactory()
     if not self.conference.conferenceday_set.exists():
         day = ConferenceDayFactory(conference=self.conference)
         if starttime:
             day.day = starttime.date()
             day.save()
     self.days = self.conference.conferenceday_set.all()
     act = act or ActFactory(b_conference=self.conference,
                             performer=self.performer,
                             accepted=3,
                             submitted=True)
     self.acts = [act]
     self.show = ShowFactory(e_conference=self.conference)
     self.room = room or RoomFactory()
     self.sched_event = None
     self.sched_event = self.schedule_instance(room=self.room,
                                               starttime=starttime)
     self.book_act(act, act_role)
Exemple #5
0
 def test_copy_only_parent_event(self):
     another_day = ConferenceDayFactory()
     another_room = RoomFactory()
     another_room.conferences.add(another_day.conference)
     data = {
         'copy_mode': 'include_parent',
         'copy_to_day': another_day.pk,
         'room': another_room.pk,
         'pick_event': "Finish",
     }
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=data, follow=True)
     max_area = StaffArea.objects.latest('pk')
     redirect_url = "%s?%s-day=%d&filter=Filter&alt_id=%s" % (
         reverse('manage_event_list',
                 urlconf='gbe.scheduling.urls',
                 args=[another_day.conference.conference_slug]),
         another_day.conference.conference_slug,
         another_day.pk,
         max_area.pk,
     )
     self.assertRedirects(response, redirect_url)
     self.assertRedirects(response, redirect_url)
     self.assertFalse(max_area.default_location)
     assert_alert_exists(
         response, 'success', 'Success',
         'A new Staff Area was created.<br>Staff Area: %s' %
         (max_area.title))
Exemple #6
0
 def test_room_to_conf_mapping(self):
     not_now_room = RoomFactory()
     login_as(self.privileged_user, self)
     response = self.client.get(self.url)
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, self.room.name)
     self.assertNotContains(response, not_now_room.name)
 def setUp(self):
     self.client = Client()
     self.user = ProfileFactory.create().user_object
     self.privileged_profile = ProfileFactory()
     self.privileged_user = self.privileged_profile.user_object
     grant_privilege(self.privileged_user, 'Volunteer Coordinator')
     self.room = RoomFactory()
     # because there was a bug around duplicate room names
     RoomFactory(name=self.room.name)
     self.context = VolunteerContext()
     self.room.conferences.add(self.context.conference)
     self.url = reverse(
         self.view_name,
         urlconf="gbe.scheduling.urls",
         args=[self.context.conference.conference_slug,
               self.context.sched_event.pk])
Exemple #8
0
 def test_create_not_avail_room_fails(self):
     not_now_room = RoomFactory()
     login_as(self.privileged_user, self)
     data = self.edit_area()
     data['default_location'] = not_now_room.pk
     response = self.client.post(self.url, data=data, follow=True)
     self.assertContains(
         response, "That choice is not one of the available choices.")
Exemple #9
0
 def test_auth_user_bad_room_assign(self):
     not_this_room = RoomFactory()
     login_as(self.privileged_user, self)
     data = self.edit_event()
     data['location'] = not_this_room.pk
     response = self.client.post(self.url, data=data, follow=True)
     self.assertContains(
         response, "That choice is not one of the available choices.")
Exemple #10
0
 def test_good_user_get_empty_room_rehearsal(self):
     not_this_room = RoomFactory()
     rehearsal, slot = self.context.make_rehearsal(room=False)
     login_as(self.privileged_profile, self)
     response = self.client.get(self.url, follow=True)
     self.assertContains(
         response, '<option value="%d" selected>%s</option>' %
         (self.context.room.pk, str(self.context.room)), 4)
     self.assertNotContains(response, str(not_this_room))
 def setUp(self):
     self.room = RoomFactory()
     self.show_volunteer = VolunteerContext()
     self.current_conference = self.show_volunteer.conference
     self.url = reverse(self.view_name,
                        args=[self.current_conference.conference_slug],
                        urlconf='gbe.scheduling.urls')
     self.client = Client()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
Exemple #12
0
    def __init__(self,
                 performer=None,
                 act=None,
                 show=None,
                 sched_event=None,
                 conference=None,
                 room_name=None,
                 schedule_rehearsal=False,
                 act_role="Regular Act",
                 set_waitlist=False):
        if conference:
            self.show = show or ShowFactory(e_conference=conference)
        else:
            self.show = show or ShowFactory()
        self.conference = conference or self.show.e_conference
        self.performer = performer or PersonaFactory()
        self.act = act or ActFactory(performer=self.performer,
                                     b_conference=self.conference,
                                     accepted=3,
                                     submitted=True)
        role = "Performer"
        if set_waitlist:
            self.act.accepted = 2
            self.act.save()
            act_role = "Waitlisted"
            role = "Waitlisted"
        self.tech = self.act.tech

        # schedule the show
        if sched_event:
            self.sched_event = sched_event
        else:
            self.sched_event = SchedEventFactory(
                eventitem=self.show.eventitem_ptr)
            EventLabelFactory(event=self.sched_event,
                              text=self.conference.conference_slug)
        room_name = room_name or "Dining Room"
        self.room = RoomFactory(name=room_name)
        self.room.conferences.add(self.conference)
        if not sched_event:
            ResourceAllocationFactory(
                event=self.sched_event,
                resource=LocationFactory(_item=self.room.locationitem_ptr))
        # schedule the act into the show
        self.booking = ResourceAllocationFactory(event=self.sched_event,
                                                 resource=WorkerFactory(
                                                     _item=self.act.performer,
                                                     role=role))
        self.order = OrderingFactory(allocation=self.booking,
                                     class_id=self.act.pk,
                                     class_name="Act",
                                     role=act_role)
        if schedule_rehearsal:
            self.rehearsal = self._schedule_rehearsal(self.sched_event,
                                                      self.act)
Exemple #13
0
 def setUp(self):
     self.room = RoomFactory()
     self.context = StaffAreaContext()
     self.context.area.default_volunteers = 7
     self.context.area.save()
     self.url = reverse(self.view_name,
                        args=[self.context.area.pk],
                        urlconf='gbe.scheduling.urls')
     self.client = Client()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
Exemple #14
0
 def setUp(self):
     self.room = RoomFactory()
     self.current_conference = ConferenceFactory(accepting_bids=True)
     self.room.conferences.add(self.current_conference)
     self.url = reverse(self.view_name,
                        args=[self.current_conference.conference_slug],
                        urlconf='gbe.scheduling.urls'
                        ) + "?pick_event=Next&event_type=staff"
     self.factory = RequestFactory()
     self.client = Client()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
Exemple #15
0
    def __init__(self,
                 profile=None,
                 bid=None,
                 event=None,
                 opportunity=None,
                 role=None):
        if not event:
            self.window = VolunteerWindowFactory()
            self.conference = self.window.day.conference
        else:
            self.conference = event.e_conference
            if not VolunteerWindow.objects.filter(
                    day__conference=self.conference).exists():
                self.window = VolunteerWindowFactory(
                    day__conference=self.conference)
            else:
                self.window = VolunteerWindow.objects.all().first()
        self.conf_day = self.window.day
        self.profile = profile or ProfileFactory()
        if not hasattr(self.profile, 'preferences'):
            ProfilePreferencesFactory(profile=self.profile)

        if bid is False:
            self.bid = None
        elif bid:
            self.bid = bid
            self.profile = self.bid.profile
        else:
            self.bid = VolunteerFactory(
                b_conference=self.conference,
                profile=self.profile)
        self.interest = VolunteerInterestFactory(
            volunteer=self.bid)
        self.event = event or ShowFactory(
            e_conference=self.conference)
        self.role = role or "Volunteer"
        self.room = RoomFactory()
        self.sched_event = SchedEventFactory(
            eventitem=self.event.eventitem_ptr,
            starttime=datetime.combine(self.window.day.day,
                                       self.window.start))
        ResourceAllocationFactory(
            event=self.sched_event,
            resource=LocationFactory(_item=self.room))
        EventLabelFactory(event=self.sched_event,
                          text="General")
        EventLabelFactory(event=self.sched_event,
                          text=self.conference.conference_slug)
        self.worker = WorkerFactory(_item=self.profile.workeritem,
                                    role=self.role)
        self.opportunity, self.opp_event = self.add_opportunity(opportunity)
        self.allocation = ResourceAllocationFactory(resource=self.worker,
                                                    event=self.opp_event)
 def setUp(self):
     self.room = RoomFactory()
     # because there was a bug around duplicate room names
     RoomFactory(name=self.room.name)
     self.teacher = PersonaFactory()
     self.current_conference = ConferenceFactory(accepting_bids=True)
     self.day = ConferenceDayFactory(conference=self.current_conference)
     self.room.conferences.add(self.current_conference)
     self.test_class = ClassFactory(b_conference=self.current_conference,
                                    e_conference=self.current_conference,
                                    accepted=3,
                                    teacher=self.teacher,
                                    submitted=True)
     self.url = reverse(
         self.view_name,
         args=[self.current_conference.conference_slug],
         urlconf='gbe.scheduling.urls')
     self.factory = RequestFactory()
     self.client = Client()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
Exemple #17
0
 def get_solo_data(self):
     another_day = ConferenceDayFactory(
         conference=self.context.conference,
         day=self.context.conf_day.day + timedelta(days=1))
     other_room = RoomFactory()
     other_room.conferences.add(another_day.conference)
     data = {
         'copy_to_day': another_day.pk,
         'room': other_room.pk,
         'copy_mode': ['choose_day'],
         'pick_mode': "Next",
     }
     return data, another_day, other_room
 def setUp(self):
     self.room = RoomFactory()
     self.show_volunteer = VolunteerContext()
     self.current_conference = self.show_volunteer.conference
     self.special_volunteer = VolunteerContext(event=GenericEventFactory(
         e_conference=self.current_conference))
     self.staff_area = StaffAreaContext(conference=self.current_conference)
     self.url = reverse(self.view_name,
                        args=[self.current_conference.conference_slug],
                        urlconf='gbe.scheduling.urls')
     self.factory = RequestFactory()
     self.client = Client()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
 def setUp(self):
     self.client = Client()
     self.user = ProfileFactory.create().user_object
     self.privileged_profile = ProfileFactory()
     self.privileged_user = self.privileged_profile.user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
     grant_privilege(self.privileged_user, 'Volunteer Coordinator')
     self.room = RoomFactory()
     self.context = ShowContext()
     self.url = reverse(self.view_name,
                        urlconf="gbe.scheduling.urls",
                        args=[
                            self.context.conference.conference_slug,
                            self.context.sched_event.pk
                        ])
Exemple #20
0
 def __init__(self,
              bid=None,
              moderator=None,
              conference=None,
              room=None,
              starttime=None):
     self.moderator = moderator or PersonaFactory()
     self.conference = conference or ConferenceFactory()
     self.bid = bid or ClassFactory(b_conference=self.conference,
                                    e_conference=self.conference,
                                    accepted=3)
     self.room = room or RoomFactory()
     self.sched_event = None
     self.sched_event = self.schedule_instance(room=self.room,
                                               starttime=starttime)
     self.days = [ConferenceDayFactory(conference=self.conference)]
Exemple #21
0
 def setUp(self):
     AvailableInterest.objects.all().delete()
     self.client = Client()
     self.user = ProfileFactory.create().user_object
     self.privileged_profile = ProfileFactory()
     self.privileged_user = self.privileged_profile.user_object
     grant_privilege(self.privileged_user, 'Volunteer Coordinator')
     self.avail_interest = AvailableInterestFactory()
     self.room = RoomFactory()
     self.context = VolunteerContext()
     self.url = reverse(self.view_name,
                        urlconf="gbe.scheduling.urls",
                        args=[
                            self.context.conference.conference_slug,
                            self.context.sched_event.pk
                        ])
Exemple #22
0
 def test_copy_parent_event_change_room(self):
     another_day = ConferenceDayFactory()
     another_room = RoomFactory()
     another_room.conferences.add(another_day.conference)
     orig_room = self.context.get_room()
     self.context.area.default_location = orig_room
     self.context.area.save()
     data = {
         'copy_mode': 'include_parent',
         'copy_to_day': another_day.pk,
         'room': another_room.pk,
         'pick_event': "Finish",
     }
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=data, follow=True)
     max_area = StaffArea.objects.latest('pk')
     self.assertEqual(another_room, max_area.default_location)
Exemple #23
0
 def test_authorized_user_get_right_rooms(self):
     not_this_room = RoomFactory()
     login_as(self.privileged_user, self)
     self.url = reverse(
         self.view_name,
         args=[self.context.opp_event.pk],
         urlconf='gbe.scheduling.urls')
     response = self.client.get(self.url)
     self.assertEqual(response.status_code, 200)
     self.assertContains(
         response,
         self.context.conf_day.day.strftime(GBE_DATE_FORMAT))
     self.assertNotContains(response, not_this_room.name)
     assert_option_state(
         response,
         self.context.room.pk,
         self.context.room.name,
         True)
Exemple #24
0
    def __init__(self,
                 profile=None,
                 event=None,
                 sched_event=None,
                 opportunity=None,
                 role=None,
                 conference=None):
        if not event:
            self.conference = conference or ConferenceFactory()
        else:
            self.conference = event.e_conference

        if ConferenceDay.objects.filter(conference=self.conference).exists():
            self.conf_day = ConferenceDay.objects.filter(
                conference=self.conference).first()
        else:
            self.conf_day = ConferenceDayFactory(conference=self.conference)
        self.profile = profile or ProfileFactory()
        if not hasattr(self.profile, 'preferences'):
            ProfilePreferencesFactory(profile=self.profile)

        self.role = role or "Volunteer"
        self.room = RoomFactory()
        self.room.conferences.add(self.conference)
        self.event = event or ShowFactory(e_conference=self.conference)

        if not sched_event:
            self.sched_event = SchedEventFactory(
                eventitem=self.event.eventitem_ptr,
                starttime=datetime.combine(self.conf_day.day, time(12, 0, 0)))
            ResourceAllocationFactory(
                event=self.sched_event,
                resource=LocationFactory(_item=self.room))
            EventLabelFactory(event=self.sched_event, text="General")
            EventLabelFactory(event=self.sched_event,
                              text=self.conference.conference_slug)
        else:
            self.sched_event = sched_event
        self.worker = WorkerFactory(_item=self.profile.workeritem,
                                    role=self.role)
        self.opportunity, self.opp_event = self.add_opportunity(opportunity)
        self.allocation = ResourceAllocationFactory(resource=self.worker,
                                                    event=self.opp_event)
Exemple #25
0
 def __init__(self,
              performer=None,
              act=None,
              show=None,
              sched_event=None,
              conference=None,
              room_name=None,
              cue_count=1,
              schedule_rehearsal=False,
              act_role=""):
     self.show = show or ShowFactory()
     self.conference = conference or self.show.e_conference
     self.performer = performer or PersonaFactory()
     self.act = act or ActFactory(performer=self.performer,
                                  b_conference=self.conference,
                                  accepted=3,
                                  submitted=True)
     self.tech = self.act.tech
     self.audio = self.tech.audio
     self.lighting = self.tech.lighting
     self.stage = self.tech.stage
     for i in range(cue_count):
         CueInfoFactory.create(techinfo=self.tech, cue_sequence=i)
     # schedule the show
     self.sched_event = sched_event or SchedEventFactory(
         eventitem=self.show.eventitem_ptr)
     room_name = room_name or "Dining Room"
     self.room = RoomFactory(name=room_name)
     if not sched_event:
         ResourceAllocationFactory(
             event=self.sched_event,
             resource=LocationFactory(_item=self.room.locationitem_ptr))
     # schedule the act into the show
     ResourceAllocationFactory(event=self.sched_event,
                               resource=ActResourceFactory(
                                   _item=self.act.actitem_ptr,
                                   role=act_role))
     if schedule_rehearsal:
         self.rehearsal = self._schedule_rehearsal(self.sched_event,
                                                   self.act)
Exemple #26
0
 def setUp(self):
     self.context = VolunteerContext(event=GenericEventFactory())
     self.context.sched_event.max_volunteer = 7
     self.context.sched_event.save()
     self.context.event.duration = timedelta(hours=1, minutes=30)
     self.context.event.save()
     self.room = self.context.room
     # because there was a bug around duplicate room names
     RoomFactory(name=self.room.name)
     self.staff_lead = self.context.set_staff_lead()
     self.extra_day = ConferenceDayFactory(
         conference=self.context.conference,
         day=self.context.conf_day.day + timedelta(days=1))
     self.url = reverse(self.view_name,
                        args=[
                            self.context.conference.conference_slug,
                            self.context.sched_event.pk
                        ],
                        urlconf='gbe.scheduling.urls')
     self.client = Client()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
Exemple #27
0
 def test_copy_child_parent_events(self):
     another_day = ConferenceDayFactory()
     another_room = RoomFactory()
     another_room.conferences.add(another_day.conference)
     data = {
         'copy_mode': 'include_parent',
         'copy_to_day': another_day.pk,
         'copied_event': self.vol_opp.pk,
         'room': another_room.room.pk,
         'pick_event': "Finish",
     }
     self.vol_opp.approval_needed = True
     self.vol_opp.save()
     login_as(self.privileged_user, self)
     max_pk = Event.objects.latest('pk').pk
     response = self.client.post(self.url, data=data, follow=True)
     new_occurrences = []
     for occurrence in Event.objects.filter(pk__gt=max_pk):
         new_occurrences += [occurrence.pk]
     redirect_url = "%s?%s-day=%d&filter=Filter&new=%s&alt_id=%s" % (
         reverse('manage_event_list',
                 urlconf='gbe.scheduling.urls',
                 args=[another_day.conference.conference_slug]),
         another_day.conference.conference_slug, another_day.pk,
         str(new_occurrences).replace(" ", "%20"), self.context.area.pk + 1)
     self.assertRedirects(response, redirect_url)
     assert_alert_exists(
         response, 'success', 'Success',
         'A new Staff Area was created.<br>Staff Area: %s' %
         (self.context.area.title))
     assert_alert_exists(
         response, 'success', 'Success',
         'Occurrence has been updated.<br>%s, Start Time: %s' %
         (self.vol_opp.eventitem.e_title,
          datetime.combine(
              another_day.day,
              self.vol_opp.starttime.time()).strftime(GBE_DATETIME_FORMAT)))
     self.assertContains(response, "approval_needed", 2)
Exemple #28
0
 def get_room(self):
     room = RoomFactory()
     room.conferences.add(self.conference)
     return room