本文整理汇总了Python中tests.functions.gbe_functions.grant_privilege函数的典型用法代码示例。如果您正苦于以下问题:Python grant_privilege函数的具体用法?Python grant_privilege怎么用?Python grant_privilege使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grant_privilege函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_set_ticket
def test_set_ticket(self):
grant_privilege(self.privileged_user, 'Ticketing - Admin')
bpt_event = BrownPaperEventsFactory(
conference=self.current_conference)
login_as(self.privileged_user, self)
data = self.edit_class()
data['bpt_events'] = bpt_event.pk
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',
link_event_to_ticket_success_msg + '%s - %s, ' % (
bpt_event.bpt_event_id,
bpt_event.title)
)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:32,代码来源:test_ticketed_event_wizard.py
示例2: test_edit_event_and_continue
def test_edit_event_and_continue(self):
grant_privilege(self.privileged_user, 'Volunteer Coordinator')
login_as(self.privileged_user, self)
data = self.edit_event()
data['edit_event'] = "Save and Continue"
response = self.client.post(
self.url,
data=data,
follow=True)
self.assertRedirects(
response,
"%s?volunteer_open=True" % self.url)
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, data['e_title'])
self.assertContains(response, data['e_description'])
self.assertContains(
response,
'<option value="%d" selected="selected">%s</option>' % (
self.extra_day.pk,
self.extra_day.day.strftime(DATE_FORMAT)))
self.assertContains(response,
'name="max_volunteer" type="number" value="3" />')
self.assertContains(
response,
'name="duration" step="any" type="number" value="2.5" />')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:32,代码来源:test_edit_event_view.py
示例3: test_edit_area_and_continue
def test_edit_area_and_continue(self):
grant_privilege(self.privileged_user, 'Volunteer Coordinator')
login_as(self.privileged_user, self)
data = self.edit_area()
data['edit_event'] = "Save and Continue"
response = self.client.post(
self.url,
data=data,
follow=True)
self.assertRedirects(
response,
"%s?volunteer_open=True" % self.url)
assert_alert_exists(
response,
'success',
'Success',
'Staff Area has been updated.<br>Title: %s' % (
data['title']))
self.assertContains(response, data['title'])
self.assertContains(response, data['description'])
self.assertContains(
response,
'<option value="%d" selected="selected">%s</option>' % (
self.privileged_user.profile.pk,
str(self.privileged_user.profile)))
self.assertContains(
response,
'name="default_volunteers" type="number" value="3" />')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:28,代码来源:test_edit_staff_area_view.py
示例4: test_vol_opp_present
def test_vol_opp_present(self):
self.context.area.default_room = self.room
self.context.area.save()
vol_opp = self.context.add_volunteer_opp()
self.extra_day = ConferenceDayFactory(
conference=self.context.conference,
day=self.context.conf_day.day + timedelta(days=1))
grant_privilege(self.privileged_user, 'Volunteer Coordinator')
login_as(self.privileged_user, self)
response = self.client.get(self.url, follow=True)
self.assertContains(
response,
'name="opp_event_id" type="hidden" value="%d" />' % (
vol_opp.eventitem.event_id)
)
self.assertContains(
response,
'name="opp_sched_id" type="hidden" value="%d" />' % (
vol_opp.pk)
)
self.assertContains(
response,
'<option value="%d" selected="selected">%s</option>' % (
self.context.conf_day.pk,
self.context.conf_day.day.strftime("%b. %-d, %Y")))
self.assertContains(
response,
'name="max_volunteer" type="number" value="7" />')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:28,代码来源:test_edit_staff_area_view.py
示例5: 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
示例6: setUp
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'}
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_costume_changestate.py
示例7: reduced_login
def reduced_login(self):
reduced_profile = ProfileFactory()
grant_privilege(
reduced_profile.user_object,
'%s Coordinator' % "Act")
login_as(reduced_profile, self)
return reduced_profile
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_mail_to_bidders.py
示例8: test_vol_opp_present
def test_vol_opp_present(self):
vol_context = VolunteerContext()
vol_context.sched_event.max_volunteer = 7
vol_context.sched_event.save()
vol_context.opp_event.set_locations([])
grant_privilege(self.privileged_user, 'Volunteer Coordinator')
login_as(self.privileged_user, self)
self.url = reverse(
self.view_name,
args=[vol_context.conference.conference_slug,
vol_context.sched_event.pk],
urlconf='gbe.scheduling.urls')
response = self.client.get(self.url, follow=True)
self.assertContains(
response,
'name="opp_event_id" type="hidden" value="%d" />' % (
vol_context.opportunity.pk)
)
self.assertContains(
response,
'name="opp_sched_id" type="hidden" value="%d" />' % (
vol_context.opp_event.pk)
)
self.assertContains(
response,
'<option value="%d" selected="selected">%s</option>' % (
vol_context.window.day.pk,
vol_context.window.day.day.strftime("%b. %-d, %Y")),
3)
self.assertContains(
response,
'name="max_volunteer" type="number" value="2" />')
self.assertContains(
response,
'name="duration" step="any" type="number" value="1.0" />')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:35,代码来源:test_edit_event_view.py
示例9: test_pick_drop_in
def test_pick_drop_in(self):
special = GenericEventFactory(
e_conference=self.context.conference,
type="Drop-In")
specialstaffcontext = VolunteerContext(
event=special,
role="Teacher"
)
limited_profile = ProfileFactory()
grant_privilege(limited_profile.user_object, "Registrar")
login_as(limited_profile, self)
data = {
'email-select-conference': [self.context.conference.pk, ],
'email-select-roles': ['Teacher', ],
'event-select-event_collections': "Drop-In",
'refine': True,
}
response = self.client.post(self.url, data=data, follow=True)
print response
self.assertNotContains(
response,
self.context.teacher.contact.user_object.email)
self.assertContains(
response,
specialstaffcontext.profile.user_object.email)
self.assertNotContains(
response,
special.e_title)
assert_checkbox(
response,
"event_collections",
1,
"Drop-In",
"All Drop-In Classes",
prefix="event-select")
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:35,代码来源:test_mail_to_roles.py
示例10: test_review_act_post_first_time
def test_review_act_post_first_time(self):
clear_conferences()
conference = ConferenceFactory(accepting_bids=True,
status='upcoming')
# conference = current_conference()
act = ActFactory(accepted=1,
b_conference=conference)
profile = ProfileFactory()
user = profile.user_object
grant_privilege(user, 'Act Reviewers')
login_as(user, self)
url = reverse('act_review',
urlconf='gbe.urls',
args=[act.pk])
data = self.get_post_data(act, profile)
response = self.client.post(url,
data,
follow=True)
self.assertEqual(response.status_code, 200)
expected_string = default_act_review_success_msg % (
act.b_title, str(act.performer)
)
error_string = default_act_review_error_msg % (
act.b_title)
self.assertContains(response, expected_string)
self.assertNotContains(response, error_string)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:26,代码来源:test_review_act.py
示例11: reduced_login
def reduced_login(self):
reduced_profile = ProfileFactory()
grant_privilege(
reduced_profile.user_object,
'Registrar')
login_as(reduced_profile, self)
return reduced_profile
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:7,代码来源:test_mail_to_person.py
示例12: setUp
def setUp(self):
Conference.objects.all().delete()
self.factory = RequestFactory()
self.client = Client()
self.privileged_profile = ProfileFactory()
self.privileged_user = self.privileged_profile.user_object
grant_privilege(self.privileged_user, 'Volunteer Coordinator')
grant_privilege(self.privileged_user, 'Volunteer Reviewers')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:8,代码来源:test_assign_volunteer.py
示例13: setUp
def setUp(self):
UserMessage.objects.all().delete()
self.client = Client()
self.performer = PersonaFactory()
self.privileged_profile = ProfileFactory()
self.privileged_user = self.privileged_profile.user_object
grant_privilege(self.privileged_user, 'Volunteer Coordinator')
grant_privilege(self.privileged_user, 'Volunteer Reviewers')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:8,代码来源:test_edit_volunteer.py
示例14: setUp
def setUp(self):
self.client = Client()
self.profile = ProfilePreferencesFactory(
profile__purchase_email='[email protected]').profile
self.privileged_user = ProfileFactory().user_object
grant_privilege(self.privileged_user, 'Registrar')
self.url = reverse('manage_users',
urlconf='gbe.urls')
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:8,代码来源:test_review_profiles_view.py
示例15: test_bad_template_w_get
def test_bad_template_w_get(self):
grant_privilege(self.privileged_profile.user_object,
'Volunteer Coordinator')
login_as(self.privileged_profile, self)
url = reverse(self.view_name,
urlconf="gbe.email.urls",
args=["not a real template"])
response = self.client.get(url)
self.assertEqual(404, response.status_code)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:9,代码来源:test_edit_template.py
示例16: test_acts_to_review
def test_acts_to_review(self):
staff_profile = ProfileFactory(user_object__is_staff=True)
grant_privilege(staff_profile, "Act Reviewers")
login_as(staff_profile, self)
act = ActFactory(submitted=True,
b_conference=self.current_conf)
url = reverse('home', urlconf='gbe.urls')
response = self.client.get(url)
nt.assert_true(act.b_title in response.content)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:9,代码来源:test_landing_page.py
示例17: test_volunteer_schedule_update_exists_w_get
def test_volunteer_schedule_update_exists_w_get(self):
grant_privilege(self.privileged_profile.user_object,
'Volunteer Coordinator')
login_as(self.privileged_profile, self)
response = self.client.get(self.url)
self.assertContains(response, self.sender.from_email)
self.assertContains(response, self.sender.template.subject)
self.assertContains(response, self.sender.template.html_content)
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:9,代码来源:test_edit_template.py
示例18: test_post_bad_data
def test_post_bad_data(self):
grant_privilege(self.privileged_profile.user_object,
'Volunteer Coordinator')
login_as(self.privileged_profile, self)
data = self.get_template_post()
del data['sender']
response = self.client.post(self.url, data=data, follow=True)
updated = EmailTemplate.objects.get(name=self.sender.template.name)
self.assertContains(response, "This field is required")
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:9,代码来源:test_edit_template.py
示例19: test_get_tickets
def test_get_tickets(self):
grant_privilege(self.privileged_user, 'Ticketing - Admin')
bpt_event = BrownPaperEventsFactory(
conference=self.current_conference)
login_as(self.privileged_user, self)
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, "%s - %s" % (bpt_event.bpt_event_id,
bpt_event.title))
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:9,代码来源:test_ticketed_event_wizard.py
示例20: setUp
def setUp(self):
self.client = Client()
self.priv_profile = ProfileFactory()
self.context = ClassContext()
self.old_conference = ConferenceFactory(status="completed")
self.old_context = ClassContext(conference=self.old_conference)
grant_privilege(self.priv_profile, 'Class Coordinator')
self.url = reverse(self.view_name,
urlconf="gbe.reporting.urls")
开发者ID:bethlakshmi,项目名称:GBE2,代码行数:9,代码来源:test_interest.py
注:本文中的tests.functions.gbe_functions.grant_privilege函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论