def test_view_list_default_view_current_conf_exists(self):
     '''
     /scheduler/view_list/ should return all events in the current
     conference, assuming a current conference exists
     '''
     other_conf = ConferenceFactory(status='completed')
     show = ShowFactory(e_conference=self.conf)
     generic_event = GenericEventFactory(e_conference=self.conf)
     accepted_class = ClassFactory(accepted=3,
                                   e_conference=self.conf,
                                   b_conference=self.conf)
     previous_class = ClassFactory(accepted=3,
                                   e_conference=other_conf,
                                   b_conference=other_conf)
     rejected_class = ClassFactory(accepted=1,
                                   e_conference=self.conf,
                                   b_conference=self.conf)
     url = reverse("event_list", urlconf="gbe.scheduling.urls")
     login_as(ProfileFactory(), self)
     response = self.client.get(url)
     self.assertContains(response, generic_event.e_title)
     self.assertContains(response, show.e_title)
     self.assertContains(response, accepted_class.e_title)
     self.assertNotContains(response, rejected_class.e_title)
     self.assertNotContains(response, previous_class.e_title)
示例#2
0
    def test_get_tickets_for_class(self):
        '''get one ticket for everything but master, and one for classes
        '''
        event = ClassFactory()
        ws_bpt_event = BrownPaperEventsFactory(
            conference=event.e_conference,
            include_most=True,
            title="The Whole Shebang 2016")
        sch_bpt_event = BrownPaperEventsFactory(
            conference=event.e_conference,
            include_conference=True,
            title="The Scholar 2016")
        whole_shebang = TicketItemFactory(
            bpt_event=ws_bpt_event,
            live=True,
            has_coupon=False)
        scholar = TicketItemFactory(
            bpt_event=sch_bpt_event,
            live=True,
            has_coupon=False)
        tickets = event.get_tickets()

        self.assertEqual(len(tickets), 2)
        self.assertEqual(
            tickets[0],
            ws_bpt_event)
        self.assertEqual(
            tickets[1],
            sch_bpt_event)
 def test_auth_user_load_panel(self):
     panel = ClassFactory(b_conference=self.current_conference,
                          e_conference=self.current_conference,
                          type="Panel",
                          accepted=3,
                          teacher=self.teacher,
                          submitted=True)
     login_as(self.privileged_user, self)
     data = self.get_data()
     data['accepted_class'] = panel.pk
     response = self.client.post(
         self.url,
         data=data,
         follow=True)
     self.assertContains(
         response,
         'value="%s"' %
         panel.b_title)
     self.assertContains(response, "Panelist")
     self.assertContains(response, "Moderator")
     self.assertContains(
         response,
         '<option value="%d" selected>%s</option>' % (
             panel.teacher.pk,
             str(panel.teacher)),
         html=True)
示例#4
0
 def post_class_edit_draft(self):
     klass = ClassFactory()
     url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')
     login_as(klass.teacher.performer_profile, self)
     data = self.get_form(submit=False)
     response = self.client.post(url, data=data, follow=True)
     return response, data
 def test_authorized_user_single_conference(self):
     other_class = ClassFactory(accepted=3,
                                submitted=True)
     login_as(self.privileged_user, self)
     response = self.client.get(self.url)
     self.assertNotContains(response, str(other_class.b_title))
     self.assertNotContains(response, str(other_class.teacher))
    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)
    def test_view_list_only_classes(self):
        '''
        /scheduler/view_list/ should return all events in the current
        conference, assuming a current conference exists
        '''
        show = ShowFactory(e_conference=self.conf)
        generic_event = GenericEventFactory(e_conference=self.conf)
        accepted_class = ClassFactory(accepted=3,
                                      e_conference=self.conf,
                                      b_conference=self.conf)
        url = reverse("event_list",
                      urlconf="gbe.scheduling.urls",
                      args=['Class'])
        login_as(ProfileFactory(), self)
        response = self.client.get(url)
        self.assertNotContains(response, show.e_title)
        self.assertNotContains(response, generic_event.e_title)
        self.assertContains(response, accepted_class.e_title)

        url = reverse("event_list",
                      urlconf="gbe.scheduling.urls",
                      args=['class'])
        response = self.client.get(url)
        self.assertNotContains(response, show.e_title)
        self.assertNotContains(response, generic_event.e_title)
        self.assertContains(response, accepted_class.e_title)
 def test_unsched_class(self):
     bid_class = ClassFactory()
     response = self.client.get(
         reverse(self.view_name,
                 urlconf="gbe.scheduling.urls",
                 args=[bid_class.eventitem_id]))
     self.assertEqual(200, response.status_code)
     self.assertEqual(1, response.content.count(bid_class.teacher.name))
示例#9
0
 def test_edit_bid_not_post(self):
     '''edit_bid, not post, should take us to edit process'''
     klass = ClassFactory()
     url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')
     login_as(klass.teacher.performer_profile, self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertTrue('Submit a Class' in response.content)
示例#10
0
 def test_edit_bid_verify_avoided_constraints(self):
     klass = ClassFactory()
     url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')
     login_as(klass.teacher.performer_profile, self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertTrue('I Would Prefer to Avoid' in response.content)
     self.assertTrue('Submit a Class' in response.content)
示例#11
0
 def test_edit_bid_verify_info_popup_text(self):
     klass = ClassFactory()
     url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')
     login_as(klass.teacher.performer_profile, self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertTrue(
         'We will do our best to accommodate' in response.content)
示例#12
0
    def test_review_class_post_form_invalid(self):
        klass = ClassFactory()
        url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.post(url, data={'accepted': 1})
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Bid Information')
示例#13
0
    def test_review_class_w_scheduling(self):
        grant_privilege(self.privileged_user, 'Scheduling Mavens')
        klass = ClassFactory()
        url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.get(url)
        self.assertContains(response, 'name="extra_button"')
示例#14
0
    def test_review_class_how_heard_is_present(self):
        klass = ClassFactory()
        klass.teacher.contact.how_heard = "[u'Facebook']"
        klass.teacher.contact.save()
        url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.get(url)
        self.assertContains(response, 'Facebook')
示例#15
0
 def test_class_edit_post_form_not_valid(self):
     '''class_edit, if form not valid, should return to ActEditForm'''
     klass = ClassFactory()
     url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')
     login_as(klass.teacher.performer_profile, self)
     data = self.get_form(invalid=True)
     response = self.client.post(url, data=data)
     self.assertEqual(response.status_code, 200)
     self.assertTrue('Submit a Class' in response.content)
示例#16
0
 def test_bad_user(self):
     klass = ClassFactory()
     reviewer = ProfileFactory()
     grant_privilege(reviewer, 'Class Reviewers')
     login_as(reviewer, self)
     url = reverse(self.view_name, args=[klass.pk], urlconf="gbe.urls")
     response = self.client.get(url)
     assert "Review Bids" in response.content
     assert response.status_code == 200
示例#17
0
    def test_view_class(self):
        '''view_class view, success
        '''
        klass = ClassFactory()
        url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')

        login_as(klass.teacher.performer_profile, self)
        response = self.client.get(url)
        assert response.status_code == 200
示例#18
0
 def test_review_class_inactive_user(self):
     ClassFactory(teacher__contact__user_object__is_active=False,
                  b_conference=self.conference,
                  e_conference=self.conference,
                  submitted=True)
     url = reverse(self.view_name, urlconf="gbe.urls")
     login_as(self.privileged_user, self)
     response = self.client.get(
         url, data={'conf_slug': self.conference.conference_slug})
     self.assertContains(response, 'gbe-table-row gbe-table-danger')
示例#19
0
    def test_review_class_no_how_heard(self):
        klass = ClassFactory()
        klass.teacher.contact.how_heard = '[]'
        klass.teacher.contact.save()
        url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.get(url)
        self.assertNotContains(response, '[]')
        self.assertContains(response, "The Presenter")
示例#20
0
    def test_review_class_all_well(self):
        klass = ClassFactory()
        url = reverse(self.view_name,
                      args=[klass.pk],
                      urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTrue('Bid Information' in response.content)
示例#21
0
 def test_classes_to_review(self):
     staff_profile = ProfileFactory(user_object__is_staff=True)
     grant_privilege(staff_profile, "Class Reviewers")
     login_as(staff_profile, self)
     klass = ClassFactory(submitted=True,
                          b_conference=self.current_conf,
                          e_conference=self.current_conf)
     url = reverse('home', urlconf='gbe.urls')
     response = self.client.get(url)
     nt.assert_true(klass.b_title in response.content)
示例#22
0
 def test_pick_no_post_action(self):
     second_class = ClassFactory(accepted=2)
     login_as(self.privileged_profile, self)
     data = {
         'email-select-conference': [self.context.conference.pk],
         'email-select-bid_type': self.priv_list,
         'email-select-state': [0, 1, 2, 3, 4, 5],
     }
     response = self.client.post(self.url, data=data, follow=True)
     assert_alert_exists(response, 'danger', 'Error', unknown_request)
示例#23
0
    def test_review_class_all_well(self):
        klass = ClassFactory()
        url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')

        login_as(self.privileged_user, self)
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, 'Bid Information')
        self.assertContains(response, "Review Bids")
        self.assertContains(response, "Bid Control for Coordinator")
        self.assertNotContains(response, 'name="extra_button"')
示例#24
0
 def test_pick_class_draft_and_accept(self):
     second_bid = ClassFactory()
     third_bid = ClassFactory(submitted=True)
     login_as(self.privileged_profile, self)
     data = {
         'email-select-conference': [
             self.context.conference.pk, second_bid.b_conference.pk,
             third_bid.b_conference.pk
         ],
         'email-select-bid_type': ["Class"],
         'email-select-state': ["Draft", 3],
         'filter':
         True,
     }
     response = self.client.post(self.url, data=data, follow=True)
     self.assertContains(response,
                         self.context.teacher.contact.user_object.email)
     self.assertContains(response,
                         second_bid.teacher.contact.user_object.email)
     self.assertNotContains(response,
                            third_bid.teacher.contact.user_object.email)
示例#25
0
 def test_review_class_valid_post_evaluation_has_correct_vote(self):
     klass = ClassFactory()
     url = reverse(self.view_name, args=[klass.pk], urlconf='gbe.urls')
     profile = self.privileged_user.profile
     login_as(self.privileged_user, self)
     data = self.get_post_data(klass)
     response = self.client.post(url, data, follow=True)
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, 'Bid Information')
     evaluation = BidEvaluation.objects.filter(evaluator=profile,
                                               bid=klass).last()
     assert evaluation.vote == data['vote']
示例#26
0
 def test_delete_performer_with_bid(self):
     ClassFactory(teacher=self.persona)
     login_as(self.persona.contact, self)
     response = self.client.post(self.url,
                                 data={'submit': 'Confirm'},
                                 follow=True)
     self.assertRedirects(response, reverse('home', urlconf="gbe.urls"))
     assert_alert_exists(
         response,
         'danger',
         'Error',
         delete_in_use)
示例#27
0
 def test_authorized_user_get_class(self):
     copy_class = ClassFactory()
     vol_context = VolunteerContext(event=copy_class)
     target_context = ClassContext()
     url = reverse(
         self.view_name,
         args=[vol_context.sched_event.pk],
         urlconf='gbe.scheduling.urls')
     login_as(self.privileged_user, self)
     response = self.client.get(url)
     #  copying ONLY volunteer events is OK, but copying the class is not
     self.assertEqual(403, response.status_code)
示例#28
0
 def test_review_accepted_class_w_scheduling(self):
     ClassFactory(accepted=3,
                  b_conference=self.conference,
                  e_conference=self.conference,
                  submitted=True)
     grant_privilege(self.privileged_user, 'Scheduling Mavens')
     url = reverse(self.view_name, urlconf="gbe.urls")
     login_as(self.privileged_user, self)
     response = self.client.get(
         url, data={'conf_slug': self.conference.conference_slug})
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, 'Bid Information')
     self.assertContains(response, "Add to Schedule")
示例#29
0
    def test_bios_teachers_unbooked_accepted(self):
        accepted_class = ClassFactory(b_conference=current_conference(),
                                      e_conference=current_conference(),
                                      accepted=3)
        url = reverse(self.view_name, urlconf="gbe.urls")
        login_as(ProfileFactory(), self)
        response = self.client.get(
            url,
            data={'conference': accepted_class.b_conference.conference_slug})

        assert response.status_code == 200
        assert accepted_class.teacher.name in response.content
        assert accepted_class.b_title in response.content
示例#30
0
 def test_review_class_past_conference(self):
     klass = ClassFactory()
     klass.b_conference.status = 'completed'
     klass.b_conference.save()
     url = reverse(self.view_name, args=[klass.pk], urlconf="gbe.urls")
     login_as(self.privileged_user, self)
     response = self.client.get(url, follow=True)
     self.assertRedirects(
         response, reverse('class_view',
                           urlconf='gbe.urls',
                           args=[klass.pk]))
     self.assertContains(response, 'Bid Information')
     self.assertNotContains(response, 'Review Information')