コード例 #1
0
    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)))
コード例 #2
0
    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")))