Beispiel #1
0
 def test_edit_costume_profile_is_not_contact(self):
     ''' Should get an error if the costume was not proposed by this user'''
     costume = CostumeFactory()
     url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
     login_as(PersonaFactory().performer_profile, self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 404)
 def test_review_costume_no_performer(self):
     costume = CostumeFactory()
     url = reverse(self.view_name, args=[costume.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)
 def setUp(self):
     self.factory = RequestFactory()
     self.client = Client()
     self.costume = CostumeFactory()
     self.privileged_user = ProfileFactory().user_object
     grant_privilege(self.privileged_user, 'Costume Coordinator')
     self.data = {'accepted': '3'}
 def test_deactivate_if_costume(self):
     costumer = CostumeFactory()
     url = reverse(self.view_name,
                   args=[costumer.profile.pk],
                   urlconf='gbe.urls')
     login_as(self.privileged_user, self)
     response = self.client.get(url, follow=True)
     self.assert_deactivated(response, costumer.profile)
Beispiel #5
0
 def test_view_costume(self):
     '''view_costume view, success
     '''
     costume = CostumeFactory()
     url = reverse(self.view_name, urlconf="gbe.urls", args=[costume.pk])
     login_as(costume.profile, self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
 def test_view_costume_how_heard(self):
     '''view_costume view, success
     '''
     profile = ProfileFactory(how_heard=['Word of mouth'])
     costume = CostumeFactory(profile=profile)
     url = reverse(self.view_name, urlconf="gbe.urls", args=[costume.pk])
     login_as(self.privileged_user, self)
     response = self.client.get(url)
     self.assertContains(response, profile.how_heard[0])
 def test_review_costume_all_well(self):
     costume = CostumeFactory(performer=self.performer)
     other_performer = PersonaFactory()
     url = reverse(self.view_name, args=[costume.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)
     self.assertContains(response, self.performer.name)
     self.assertNotContains(response, other_performer.name)
Beispiel #8
0
    def post_edit_costume_draft(self):
        persona = PersonaFactory()
        costume = CostumeFactory(profile=persona.performer_profile,
                                 performer=persona)

        url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
        data = self.get_costume_form(submit=False)
        login_as(costume.profile, self)
        response = self.client.post(url, data=data, follow=True)
        return response
Beispiel #9
0
    def test_costumes_to_review(self):
        staff_profile = ProfileFactory(user_object__is_staff=True)
        grant_privilege(staff_profile, "Costume Reviewers")
        login_as(staff_profile, self)
        costume = CostumeFactory(submitted=True,
                                 b_conference=self.current_conf)
        url = reverse('home', urlconf='gbe.urls')
        response = self.client.get(url)

        assert costume.b_title in response.content
Beispiel #10
0
 def test_costume_edit_post_form_not_valid(self):
     '''costume_edit, if form not valid, should return to edit'''
     costume = CostumeFactory()
     PersonaFactory(performer_profile=costume.profile,
                    contact=costume.profile)
     url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
     data = self.get_costume_form(invalid=True)
     login_as(costume.profile, self)
     response = self.client.post(url, data=data)
     self.assertEqual(response.status_code, 404)
 def test_review_costume_inactive_user(self):
     self.costumes = CostumeFactory(
         b_conference=self.conference,
         submitted=True,
         profile__user_object__is_active=False)
     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.assertIn('bid-table danger', response.content)
 def setUp(self):
     self.client = Client()
     self.performer = PersonaFactory()
     self.privileged_profile = ProfileFactory()
     self.privileged_user = self.privileged_profile.user_object
     grant_privilege(self.privileged_user, 'Costume Reviewers')
     self.conference = current_conference()
     self.costumes = CostumeFactory.create_batch(
         4,
         b_conference=self.conference,
         submitted=True)
Beispiel #13
0
 def test_review_costume_past_conference(self):
     conference = ConferenceFactory(status='completed')
     costume = CostumeFactory(b_conference=conference,
                              performer=self.performer)
     url = reverse(self.view_name, args=[costume.pk], urlconf="gbe.urls")
     login_as(self.privileged_user, self)
     response = self.client.get(url, follow=True)
     self.assertRedirects(
         response,
         reverse('costume_view', urlconf='gbe.urls', args=[costume.pk]))
     self.assertTrue('Bid Information' in response.content)
     self.assertFalse('Review Information' in response.content)
Beispiel #14
0
 def test_review_costume_post_valid(self):
     bid = CostumeFactory(performer=self.performer)
     url = reverse(self.view_name, args=[bid.pk], urlconf='gbe.urls')
     login_as(self.coordinator, self)
     data = self.get_form(bid, self.coordinator)
     response = self.client.post(url, data=data, follow=True)
     self.assertEqual(response.status_code, 200)
     html_tag = '<h2 class="review-title">%s</h2>'
     title_string = ("Bid Information for %s" %
                     bid.b_conference.conference_name)
     html_title = html_tag % title_string
     assert html_title in response.content
Beispiel #15
0
 def test_edit_bid_not_post(self):
     '''edit_costume, not post, should take us to edit process'''
     persona = PersonaFactory()
     costume = CostumeFactory(profile=persona.performer_profile,
                              performer=persona)
     url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
     data = self.get_costume_form()
     login_as(costume.profile, self)
     response = self.client.get(url)
     expected_text = "Displaying a Costume"
     self.assertTrue(expected_text in response.content)
     self.assertContains(response, costume.b_description)
    def test_submit_bid_post_invalid(self):
        '''edit_costume, not submitting and no other problems,
        should redirect to home'''
        persona = PersonaFactory()
        costume = CostumeFactory(profile=persona.performer_profile,
                                 performer=persona)

        url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
        data = self.get_costume_form(submit=True)
        data['b_title'] = ''
        data['b_description'] = ''
        login_as(costume.profile, self)
        response = self.client.post(url, data=data)
        self.assertContains(response, 'This field is required.', count=2)
Beispiel #17
0
    def test_edit_bid_post_invalid(self):
        '''edit_costume, not submitting and no other problems,
        should redirect to home'''
        persona = PersonaFactory()
        costume = CostumeFactory(profile=persona.performer_profile,
                                 performer=persona)

        url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
        data = self.get_costume_form(invalid=True)
        login_as(costume.profile, self)
        response = self.client.post(url, data=data)
        expected_string = "Costume Information"
        self.assertTrue(expected_string in response.content)
        self.assertEqual(response.status_code, 200)
Beispiel #18
0
    def setUp(self):
        self.client = Client()
        # Conference Setup
        self.factory = RequestFactory()
        self.current_conf = ConferenceFactory(accepting_bids=True,
                                              status='upcoming')
        self.previous_conf = ConferenceFactory(accepting_bids=False,
                                               status='completed')

        # User/Human setup
        self.profile = ProfileFactory()
        self.performer = PersonaFactory(performer_profile=self.profile,
                                        contact=self.profile)
        # Bid types previous and current
        self.current_act = ActFactory(performer=self.performer,
                                      submitted=True,
                                      b_conference=self.current_conf)
        self.previous_act = ActFactory(performer=self.performer,
                                       submitted=True,
                                       b_conference=self.previous_conf)
        self.current_class = ClassFactory(teacher=self.performer,
                                          submitted=True,
                                          accepted=3,
                                          b_conference=self.current_conf,
                                          e_conference=self.current_conf)
        self.previous_class = ClassFactory(teacher=self.performer,
                                           submitted=True,
                                           accepted=3,
                                           b_conference=self.previous_conf,
                                           e_conference=self.previous_conf)

        self.current_vendor = VendorFactory(profile=self.profile,
                                            submitted=True,
                                            b_conference=self.current_conf)
        self.previous_vendor = VendorFactory(profile=self.profile,
                                             submitted=True,
                                             b_conference=self.previous_conf)

        self.current_costume = CostumeFactory(profile=self.profile,
                                              submitted=True,
                                              b_conference=self.current_conf)
        self.previous_costume = CostumeFactory(profile=self.profile,
                                               submitted=True,
                                               b_conference=self.previous_conf)
        self.current_volunteer = VolunteerFactory(
            profile=self.profile,
            submitted=True,
            b_conference=self.current_conf)
        self.previous_volunteer = VolunteerFactory(
            profile=self.profile,
            submitted=True,
            b_conference=self.previous_conf)

        # Event assignments, previous and current
        current_opportunity = GenericEventFactory(
            e_conference=self.current_conf, type='Volunteer')
        previous_opportunity = GenericEventFactory(
            e_conference=self.previous_conf)

        self.current_sched = SchedEventFactory(eventitem=current_opportunity,
                                               starttime=datetime(
                                                   2016, 2, 5, 12, 30, 0, 0,
                                                   pytz.utc),
                                               max_volunteer=10)
        self.previous_sched = SchedEventFactory(eventitem=previous_opportunity,
                                                starttime=datetime(
                                                    2015, 2, 25, 12, 30, 0, 0,
                                                    pytz.utc),
                                                max_volunteer=10)

        self.current_class_sched = SchedEventFactory(
            eventitem=self.current_class,
            starttime=datetime(2016, 2, 5, 2, 30, 0, 0, pytz.utc),
            max_volunteer=10)
        self.previous_class_sched = SchedEventFactory(
            eventitem=self.previous_class,
            starttime=datetime(2015, 2, 25, 2, 30, 0, 0, pytz.utc),
            max_volunteer=10)

        worker = WorkerFactory(_item=self.profile, role='Volunteer')
        for schedule_item in [self.current_sched, self.previous_sched]:
            volunteer_assignment = ResourceAllocationFactory(
                event=schedule_item, resource=worker)
            LabelFactory(text="label %d" % volunteer_assignment.pk,
                         allocation=volunteer_assignment)

        persona_worker = WorkerFactory(_item=self.performer, role='Teacher')
        for schedule_item in [
                self.current_class_sched, self.previous_class_sched
        ]:
            volunteer_assignment = ResourceAllocationFactory(
                event=schedule_item, resource=worker)
Beispiel #19
0
 def test_edit_costume_no_profile(self):
     costume = CostumeFactory()
     url = reverse(self.view_name, args=[costume.pk], urlconf='gbe.urls')
     login_as(UserFactory(), self)
     response = self.client.get(url)
     self.assertEqual(response.status_code, 302)