• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python gbe_functions.login_as函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.functions.gbe_functions.login_as函数的典型用法代码示例。如果您正苦于以下问题:Python login_as函数的具体用法?Python login_as怎么用?Python login_as使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了login_as函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_set_eval

    def test_set_eval(self):
        q1 = EventEvalQuestionFactory(answer_type="grade")
        q2 = EventEvalQuestionFactory(answer_type="text")
        q3 = EventEvalQuestionFactory(answer_type="boolean")

        login_as(self.profile, self)
        response = self.client.post(
            self.url,
            data={
                'question%d' % self.q0.pk: "A",
                'question%d' % q1.pk: "B",
                'question%d' % q2.pk: "This is Test Text.",
                'question%d' % q3.pk: True,
                },
            follow=True)
        assert_alert_exists(
            response,
            'info',
            'Info',
            eval_success_msg)
        self.assertEqual(
            2,
            EventEvalGrade.objects.filter(
                event=self.context.sched_event).count())
        self.assertEqual(
            1,
            EventEvalComment.objects.filter(
                event=self.context.sched_event).count())
        self.assertEqual(
            1,
            EventEvalBoolean.objects.filter(
                event=self.context.sched_event).count())
        self.assertRedirects(response, reverse('home', urlconf='gbe.urls'))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:33,代码来源:test_eval_event_view.py


示例2: test_special_not_registrar

 def test_special_not_registrar(self):
     coordinator = ProfileFactory().user_object
     grant_privilege(coordinator, 'Volunteer Coordinator')
     login_as(coordinator, self)
     response = self.client.get(self.url)
     self.assertNotIn("/profile/admin/", response.content)
     self.assertNotIn("/profile/delete/", response.content)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_review_profiles_view.py


示例3: test_edit_event_w_staffing

 def test_edit_event_w_staffing(self):
     login_as(self.privileged_user, self)
     data = self.edit_event()
     data['alloc_0-worker'] = self.privileged_user.profile.pk
     response = self.client.post(
         self.url,
         data=data,
         follow=True)
     self.assertRedirects(
         response,
         "%s?%s-day=%d&filter=Filter&new=[%dL]" % (
             reverse('manage_event_list',
                     urlconf='gbe.scheduling.urls',
                     args=[self.context.conference.conference_slug]),
             self.context.conference.conference_slug,
             self.extra_day.pk,
             self.context.sched_event.pk))
     assert_alert_exists(
         response,
         'success',
         'Success',
         'Occurrence has been updated.<br>%s, Start Time: %s 11:00 AM' % (
             data['e_title'],
             self.extra_day.day.strftime(DATE_FORMAT))
         )
     self.assertContains(
         response,
         '<tr class="bid-table success">\n       ' +
         '<td class="bid-table">%s</td>' % data['e_title'])
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:29,代码来源:test_edit_event_view.py


示例4: test_review_volunteer_w_conf

    def test_review_volunteer_w_conf(self):
        ''' when a specific conf has specific bids, check bid details'''
        volunteer = VolunteerFactory(
            submitted=True)
        interest = VolunteerInterestFactory(
            volunteer=self.volunteer
        )
        volunteer.profile.user_object.email = "[email protected]"
        volunteer.profile.user_object.save()
        prefs = ProfilePreferencesFactory(
            profile=volunteer.profile,
            in_hotel="Maybe",
            inform_about=True,
            show_hotel_infobox=True)
        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_true(str(self.volunteer.number_shifts) in response.content)
        nt.assert_true(self.volunteer.background in response.content)
        nt.assert_true(self.volunteer.profile.display_name in response.content)
        nt.assert_true(interest.interest.interest in response.content)
        nt.assert_true(
            self.volunteer.profile.user_object.email in response.content)
        nt.assert_true(self.prefs.in_hotel in response.content)
        nt.assert_true("Needs Review" in response.content)
        nt.assert_true("Review" in response.content)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:30,代码来源:test_review_volunteer_list.py


示例5: test_create_troupe_performer_exists

 def test_create_troupe_performer_exists(self):
     contact = PersonaFactory()
     login_as(contact.performer_profile, self)
     url = reverse(self.view_name, urlconf='gbe.urls')
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertTrue(self.troupe_string in response.content)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_edit_troupe.py


示例6: test_review_volunteer_has_old_commitments

    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)))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:30,代码来源:test_review_volunteer_list.py


示例7: test_review_volunteer_no_profile

 def test_review_volunteer_no_profile(self):
     ''' user does not have a profile, gets permission denied'''
     login_as(UserFactory(), self)
     response = self.client.get(
         self.url,
         {'conf_slug': self.volunteer.b_conference.conference_slug})
     nt.assert_equal(response.status_code, 403)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_review_volunteer_list.py


示例8: test_schedule

 def test_schedule(self):
     login_as(ProfileFactory(), self)
     response = self.client.get(self.url)
     self.assertTrue(response.content.count('\n') > 1)
     self.assertTrue(len(
         (response.content.split('\r\n')[1].split('","'))) >= 8)
     self.assertIn(self.showcontext.show.e_title, response.content)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_export_calendar.py


示例9: test_create_volunteer_post_form_invalid

 def test_create_volunteer_post_form_invalid(self):
     url = reverse(self.view_name,
                   urlconf='gbe.urls')
     login_as(self.profile, self)
     data = self.get_volunteer_form(invalid=True)
     response = self.client.post(url, data=data)
     self.assertEqual(response.status_code, 200)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_create_volunteer.py


示例10: test_copy_child_event

 def test_copy_child_event(self):
     target_context = StaffAreaContext()
     target_day = ConferenceDayFactory(
         conference=target_context.conference,
         day=self.context.conf_day.day + timedelta(days=340))
     data = {
         'copy_mode': 'copy_children_only',
         'target_event': target_context.area.pk,
         'copied_event': self.vol_opp.pk,
         'pick_event': "Finish",
     }
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=data, follow=True)
     max_pk = Event.objects.latest('pk').pk
     redirect_url = "%s?%s-day=%d&filter=Filter&new=%s" % (
         reverse('manage_event_list',
                 urlconf='gbe.scheduling.urls',
                 args=[target_context.conference.conference_slug]),
         target_context.conference.conference_slug,
         target_day.pk,
         str([max_pk]),)
     self.assertRedirects(response, redirect_url)
     assert_alert_exists(
         response,
         'success',
         'Success',
         'Occurrence has been updated.<br>%s, Start Time: %s' % (
             self.vol_opp.eventitem.e_title,
             datetime.combine(
                 target_day.day,
                 self.vol_opp.starttime.time()).strftime(
                 DATETIME_FORMAT)))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:32,代码来源:test_copy_staff_area_view.py


示例11: test_copy_only_parent_event

 def test_copy_only_parent_event(self):
     another_day = ConferenceDayFactory()
     data = {
         'copy_mode': 'include_parent',
         'copy_to_day': another_day.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)
     assert_alert_exists(
         response,
         'success',
         'Success',
         'A new Staff Area was created.<br>Staff Area: %s' % (
             max_area.title))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:25,代码来源:test_copy_staff_area_view.py


示例12: test_authorized_user_pick_mode_only_children

 def test_authorized_user_pick_mode_only_children(self):
     target_context = StaffAreaContext()
     delta = timedelta(days=340)
     target_day = ConferenceDayFactory(
         conference=target_context.conference,
         day=self.context.conf_day.day + delta)
     data = {
         'copy_mode': 'copy_children_only',
         'target_event': target_context.area.pk,
         'pick_mode': "Next",
     }
     login_as(self.privileged_user, self)
     response = self.client.post(self.url, data=data, follow=True)
     self.assertContains(
         response,
         '<input checked="checked" id="id_copy_mode_0" name="copy_mode" ' +
         'type="radio" value="copy_children_only" />')
     self.assertContains(
         response,
         '<option value="%d" selected="selected">' % (
             target_context.area.pk))
     self.assertContains(response, "Choose Sub-Events to be copied")
     self.assertContains(response, "%s - %s" % (
         self.vol_opp.eventitem.e_title,
         (self.vol_opp.start_time + delta).strftime(
                     self.copy_date_format)))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:26,代码来源:test_copy_staff_area_view.py


示例13: test_copy_opportunity

 def test_copy_opportunity(self):
     login_as(self.privileged_profile, self)
     data = self.get_basic_data(self.context)
     data['duplicate_slot'] = 'duplicate_slot'
     response = self.client.post(
         self.url,
         data=data,
         follow=True)
     self.assertContains(
         response,
         '<div id="collapse3" class="panel-collapse collapse in">')
     slots = EventContainer.objects.filter(
         parent_event=self.context.sched_event)
     self.assertTrue(len(slots), 1)
     for slot in slots:
         self.assertContains(
             response,
             '<input id="id_e_title" maxlength="128" '
             'name="e_title" type="text" value="%s" />' % (
                 slot.child_event.eventitem.child().e_title))
         self.assertRedirects(
             response,
             "%s?changed_id=%d&rehearsal_open=True" % (
                 reverse(
                     'edit_show',
                     urlconf='gbe.scheduling.urls',
                     args=[self.context.conference.conference_slug,
                           self.context.sched_event.pk]),
                 slot.child_event.pk))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:29,代码来源:test_edit_show_view.py


示例14: test_create_slot

    def test_create_slot(self):
        login_as(self.privileged_profile, self)
        response = self.client.post(
            self.url,
            data=self.get_new_slot_data(self.context),
            follow=True)
        self.assertContains(
            response,
            '<div id="collapse3" class="panel-collapse collapse in">')
        slots = EventContainer.objects.filter(
            parent_event=self.context.sched_event)
        self.assertTrue(slots.exists())
        for slot in slots:
            self.assertEqual(slot.child_event.eventitem.child().e_title,
                             'New Rehearsal Slot')
            self.assertRedirects(
                response,
                "%s?changed_id=%d&rehearsal_open=True" % (
                    reverse('edit_show',
                            urlconf='gbe.scheduling.urls',
                            args=[self.context.conference.conference_slug,
                                  self.context.sched_event.pk]),
                    slot.child_event.pk))
            self.assertEqual(EventLabel.objects.filter(
                text=slot.child_event.eventitem.child(
                    ).e_conference.conference_slug,
                event=slot.child_event).count(), 1)
            self.assertEqual(EventLabel.objects.filter(
                event=slot.child_event).count(), 1)

        self.assertContains(
            response,
            '<input id="id_e_title" maxlength="128" name="e_title" ' +
            'type="text" value="New Rehearsal Slot" />')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:34,代码来源:test_edit_show_view.py


示例15: test_volunteer_conflict_sends_warning_to_areastaff

 def test_volunteer_conflict_sends_warning_to_areastaff(self):
     context = VolunteerContext()
     area = StaffAreaFactory(conference=context.conference,
                             staff_lead=context.profile)
     EventLabelFactory(
         event=context.opp_event,
         text=area.slug)
     change_window = context.add_window()
     context.bid.available_windows.add(context.window)
     form = self.get_form(context)
     form['available_windows'] = [change_window.pk]
     url = reverse('volunteer_edit',
                   urlconf='gbe.urls',
                   args=[context.bid.pk])
     login_as(context.profile, self)
     response = self.client.post(
         url,
         form,
         follow=True)
     assert_right_mail_right_addresses(
         1,
         3,
         "URGENT: Volunteer Schedule Conflict Occurred",
         [self.privileged_profile.contact_email,
          context.profile.contact_email])
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:25,代码来源:test_edit_volunteer.py


示例16: post_class_proposal

 def post_class_proposal(self):
     current_conference()
     url = reverse(self.view_name, urlconf="gbe.urls")
     data = self.get_class_form(valid=True)
     login_as(UserFactory(), self)
     response = self.client.post(url, data=data, follow=True)
     return response
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_propose_class.py


示例17: test_edit_volunteer_no_volunteer

 def test_edit_volunteer_no_volunteer(self):
     url = reverse('volunteer_edit',
                   urlconf='gbe.urls',
                   args=[0])
     login_as(ProfileFactory(), self)
     response = self.client.get(url)
     self.assertEqual(404, response.status_code)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_edit_volunteer.py


示例18: test_propose_invalid_class

 def test_propose_invalid_class(self):
     current_conference()
     url = reverse(self.view_name, urlconf="gbe.urls")
     data = self.get_class_form(valid=False)
     login_as(UserFactory(), self)
     response = self.client.post(url, data=data)
     self.assertEqual(response.status_code, 200)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_propose_class.py


示例19: test_review_volunteer_bad_user

 def test_review_volunteer_bad_user(self):
     ''' user does not have the right privilege and permission is denied'''
     login_as(ProfileFactory(), self)
     response = self.client.get(
         self.url,
         {'conf_slug': self.volunteer.b_conference.conference_slug})
     nt.assert_equal(response.status_code, 403)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_review_volunteer_list.py


示例20: test_create_master

 def test_create_master(self):
     login_as(self.privileged_user, self)
     data = self.edit_class()
     response = self.client.post(
         self.url,
         data=data,
         follow=True)
     new_class = GenericEvent.objects.get(e_title=data['e_title'])
     self.assertEqual(new_class.type, "Master")
     occurrence = Event.objects.get(
         eventitem__eventitem_id=new_class.eventitem_id)
     self.assertRedirects(
         response,
         "%s?%s-day=%d&filter=Filter&new=[%dL]" % (
             reverse('manage_event_list',
                     urlconf='gbe.scheduling.urls',
                     args=[self.current_conference.conference_slug]),
             self.current_conference.conference_slug,
             self.day.pk,
             occurrence.pk))
     assert_alert_exists(
         response,
         'success',
         'Success',
         'Occurrence has been updated.<br>%s, Start Time: %s 11:00 AM' % (
             data['e_title'],
             self.day.day.strftime(DATE_FORMAT))
         )
     self.assertContains(
         response,
         '<tr class="bid-table success">\n       ' +
         '<td class="bid-table">%s</td>' % data['e_title'])
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:32,代码来源:test_ticketed_event_wizard.py



注:本文中的tests.functions.gbe_functions.login_as函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python game.load_session函数代码示例发布时间:2022-05-27
下一篇:
Python gbe_functions.grant_privilege函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap