Пример #1
0
 def test_good_user_get_w_interest(self):
     AvailableInterestFactory()
     AvailableInterestFactory(visible=False)
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
     login_as(self.privileged_profile, self)
     response = self.client.get(self.url, follow=True)
     self.assert_volunteer_type_selector(response)
    def test_review_volunteer_has_old_commitments(self):
        ''' when a volunteer is booked in old conference, it should not show'''
        past_conference = ConferenceFactory(accepting_bids=False,
                                            status='completed')
        past_opportunity = GenericEventFactory(
            e_conference=past_conference,
            volunteer_type=AvailableInterestFactory(interest='Security/usher'),
            type='Volunteer')
        past_opportunity.save()
        booked_sched = sEvent(
            eventitem=past_opportunity,
            starttime=datetime(2016, 2, 6, 9, 0, 0, 0, pytz.utc),
            max_volunteer=1)
        booked_sched.save()
        worker = Worker(_item=self.volunteer.profile, role='Volunteer')
        worker.save()
        volunteer_assignment = ResourceAllocationFactory(
            event=booked_sched,
            resource=worker
        )
        login_as(self.privileged_user, self)
        response = self.client.get(
            self.url,
            {'conf_slug': self.volunteer.b_conference.conference_slug})

        nt.assert_equal(response.status_code, 200)
        nt.assert_true('Bid Information' in response.content)
        nt.assert_false(str(past_opportunity) in response.content,
                        msg="The commitment %s is showing up" % (
                            str(past_opportunity)))
Пример #3
0
    def test_review_volunteer_with_interest(self):
        volunteer = VolunteerFactory()
        interest = VolunteerInterestFactory(
            volunteer=volunteer,
            interest=AvailableInterestFactory(help_text="help!"))
        url = reverse(self.view_name, args=[volunteer.pk], urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.get(url)
        assert_interest_view(response, interest)
Пример #4
0
 def setUp(self):
     self.factory = RequestFactory()
     self.client = Client()
     self.profile = ProfileFactory()
     Conference.objects.all().delete()
     UserMessage.objects.all().delete()
     AvailableInterest.objects.all().delete()
     self.conference = ConferenceFactory(accepting_bids=True)
     days = ConferenceDayFactory.create_batch(3, conference=self.conference)
     [VolunteerWindowFactory(day=day) for day in days]
     self.interest = AvailableInterestFactory()
Пример #5
0
 def test_good_user_get_interests(self):
     old_interest = AvailableInterestFactory(
         visible=False,
         interest="old interest")
     login_as(self.privileged_profile, self)
     response = self.client.get(self.url)
     self.assertEqual(response.status_code, 200)
     self.assertContains(
         response,
         self.another_interest.interest)
     self.assertNotContains(
         response,
         old_interest.interest)
Пример #6
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
                        ])
Пример #7
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, 'Scheduling Mavens')
     self.url = reverse(self.view_name,
                        urlconf="gbe.scheduling.urls")
     self.volunteer_context = VolunteerContext()
     self.day = self.volunteer_context.window.day
     self.class_context = ClassContext(conference=self.day.conference)
     self.another_interest = AvailableInterestFactory(interest="one more")
     self.show_context = ShowContext(conference=self.day.conference)
     self.staff_context = StaffAreaContext(conference=self.day.conference)
     booking, self.vol_opp = self.staff_context.book_volunteer()
    def test_review_volunteer_has_commitments(self):
        ''' when a volunteer is already booked somewhere, it should show up'''

        current_opportunity = GenericEventFactory(
            e_conference=self.volunteer.b_conference,
            volunteer_type=AvailableInterestFactory(interest='Security/usher'),
            type='Volunteer')
        current_opportunity.save()
        booked_sched = sEvent(
            eventitem=current_opportunity,
            starttime=datetime(2016, 2, 6, 9, 0, 0, 0, pytz.utc),
            max_volunteer=1)
        booked_sched.save()
        worker = Worker(_item=self.volunteer.profile, role='Volunteer')
        worker.save()
        volunteer_assignment = ResourceAllocationFactory(
            event=booked_sched,
            resource=worker
        )
        login_as(self.privileged_user, self)
        response = self.client.get(
            self.url,
            {'conf_slug': self.volunteer.b_conference.conference_slug})

        nt.assert_equal(response.status_code, 200)
        nt.assert_true('Bid Information' in response.content)
        nt.assert_equal(
            response.content.count(str(current_opportunity)),
            1,
            msg="The commitment %s is not showing up" % (
                str(current_opportunity)))
        nt.assert_in(
            date_format(booked_sched.start_time, "DATETIME_FORMAT"),
            response.content,
            msg="start time for commitment (%s) didn't show up" % (
                date_format(booked_sched.start_time, "DATETIME_FORMAT")))
        nt.assert_in(
            date_format(booked_sched.end_time, "TIME_FORMAT"),
            response.content,
            msg="end time for commitment (%s) didn't show up" % (
                date_format(booked_sched.end_time, "TIME_FORMAT")))