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

Python fixtures.get_user函数代码示例

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

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



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

示例1: test_application_member_membership

 def test_application_member_membership(self):
     user = get_user('app-owner')
     member = get_user('app-member')
     application = fixtures.get_application(owner=user)
     models.ApplicationMembership.objects.create(
         application=application, user=member)
     ok_(application.has_member(member))
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py


示例2: test_authenticated_request_is_successful

 def test_authenticated_request_is_successful(self):
     fixtures.get_user('hello')
     self.client.login(username='hello', password='hello')
     url = '/accounts/password/change/done/'
     response = self.client.get(url)
     eq_(response.status_code, 200)
     _teardown_profiles()
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:registration_tests.py


示例3: test_draft_app_is_visible_by_member

 def test_draft_app_is_visible_by_member(self):
     user = get_user('app-owner')
     member = get_user('app-member')
     application = fixtures.get_application(
         owner=user, status=models.Application.DRAFT)
     models.ApplicationMembership.objects.create(
         application=application, user=member)
     ok_(application.is_visible_by(member))
开发者ID:jendc123,项目名称:us_ignite,代码行数:8,代码来源:models_tests.py


示例4: test_app_is_not_editable_by_member

 def test_app_is_not_editable_by_member(self):
     user = get_user('app-owner')
     member = get_user('member')
     application = fixtures.get_application(
         owner=user, status=models.Application.DRAFT)
     models.ApplicationMembership.objects.create(
         application=application, user=member, can_edit=False)
     eq_(application.is_editable_by(member), False)
开发者ID:jendc123,项目名称:us_ignite,代码行数:8,代码来源:models_tests.py


示例5: test_login_page_succeeds

 def test_login_page_succeeds(self):
     fixtures.get_user('hello', email='[email protected]')
     payload  = {
         'username': '[email protected]',
         'password': 'hello',
     }
     response = self.client.post('/accounts/login/', payload)
     assert_redirects(response, '/accounts/profile/')
开发者ID:jendc123,项目名称:us_ignite,代码行数:8,代码来源:registration_tests.py


示例6: test_member_cannot_change_app_membership

 def test_member_cannot_change_app_membership(self):
     owner = get_user('owner')
     member = get_user('member', email='[email protected]')
     app = fixtures.get_application(
         slug='delta', status=Application.PUBLISHED, owner=owner)
     payload = _get_appmember_payload(app.id)
     request = utils.get_request(
         'post', '/app/delta/membership/', data=payload, user=member)
     assert_raises(Http404, views.app_membership, request, 'delta')
开发者ID:jendc123,项目名称:us_ignite,代码行数:9,代码来源:views_tests.py


示例7: test_valid_request_succeeds

 def test_valid_request_succeeds(self):
     fixtures.get_user('hello', email='[email protected]')
     payload = {
         'email': '[email protected]',
     }
     response = self.client.post('/accounts/password/reset/', payload)
     assert_redirects(response, reverse('password_reset_done'))
     eq_(len(mail.outbox), 1)
     expected_url = '%s/accounts/password/reset/confirm/' % settings.SITE_URL
     ok_(expected_url in mail.outbox[0].body)
开发者ID:jendc123,项目名称:us_ignite,代码行数:10,代码来源:registration_tests.py


示例8: test_users_can_be_reverse_sorted

 def test_users_can_be_reverse_sorted(self):
     user_a = fixtures.get_user('alpha')
     profile_a = fixtures.get_profile(user=user_a, name='alpha')
     user_b = fixtures.get_user('beta')
     profile_b = fixtures.get_profile(user=user_b, name='beta')
     request = self._get_request(data={'order': '-user__first_name'})
     response = views.profile_list(request)
     eq_(list(response.context_data['page'].object_list),
         [profile_b, profile_a])
     _teardown_profiles()
开发者ID:us-ignite,项目名称:us_ignite,代码行数:10,代码来源:views_tests.py


示例9: test_application_membership_creation

 def test_application_membership_creation(self):
     user = get_user('app-owner')
     member = get_user('member')
     application = fixtures.get_application(owner=user)
     data = {
         'user': member,
         'application': application,
     }
     instance = models.ApplicationMembership.objects.create(**data)
     eq_(instance.user, member)
     eq_(instance.application, application)
     eq_(instance.can_edit, False)
     ok_(instance.created)
开发者ID:jendc123,项目名称:us_ignite,代码行数:13,代码来源:models_tests.py


示例10: test_export_does_not_show_innactive_users

 def test_export_does_not_show_innactive_users(self):
     url = '/admin/profiles/profile/export/'
     innactive_user = fixtures.get_user(
         'paul', first_name='Paul', email='[email protected]',
         is_active=False)
     fixtures.get_profile(user=innactive_user)
     user = fixtures.get_user(
         'john', first_name='John Donne', email='[email protected]')
     fixtures.get_profile(user=user)
     response = self.client.post(url, {})
     eq_(response.status_code, 200)
     ok_('attachment;' in response['Content-Disposition'])
     eq_(response.content, 'John Donne,[email protected]\r\n')
开发者ID:jendc123,项目名称:us_ignite,代码行数:13,代码来源:admin_tests.py


示例11: test_valid_membership_adds_user

 def test_valid_membership_adds_user(self):
     owner = get_user('owner')
     member = get_user('member', email='[email protected]')
     app = fixtures.get_application(
         slug='delta', status=Application.PUBLISHED, owner=owner)
     payload = _get_appmember_payload(
         app.id, collaborators='[email protected]')
     request = self.factory.post('/app/delta/membership/', payload)
     request.user = owner
     request._messages = utils.TestMessagesBackend(request)
     response = views.app_membership(request, 'delta')
     ok_(app.members.get(id=member.id))
     eq_(response.status_code, 302)
     eq_(response['Location'], app.get_membership_url())
开发者ID:jendc123,项目名称:us_ignite,代码行数:14,代码来源:views_tests.py


示例12: test_get_entries_for_apps_returns_entry

 def test_get_entries_for_apps_returns_entry(self):
     user = get_user('us-ignite')
     challenge = fixtures.get_challenge(user=user)
     application = get_application(owner=user)
     entry = fixtures.get_entry(application, challenge=challenge)
     result = Entry.objects.get_entries_for_apps(challenge, [application])
     eq_(result, [AppEntry(application=application, entry=entry)])
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:managers_tests.py


示例13: test_existing_entry_is_returned

 def test_existing_entry_is_returned(self):
     user = get_user('us-ignite')
     challenge = fixtures.get_challenge(user=user)
     application = get_application(owner=user)
     entry = fixtures.get_entry(
         application, challenge=challenge, status=Entry.SUBMITTED)
     eq_(Entry.objects.get_entry_or_none(challenge, application), entry)
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:managers_tests.py


示例14: test_is_visible_for_published_challenges

 def test_is_visible_for_published_challenges(self):
     user = get_user('us-ignite')
     challenge = fixtures.get_challenge(user=user)
     application = get_application(owner=user)
     entry = fixtures.get_entry(
         application, challenge=challenge, status=Entry.SUBMITTED)
     eq_(entry.is_visible_by(utils.get_anon_mock()), True)
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py


示例15: test_application_creation_is_successful

 def test_application_creation_is_successful(self):
     user = get_user('us-ignite')
     data = {
         'name': 'Gigabit app',
         'owner': user,
     }
     instance = models.Application.objects.create(**data)
     ok_(instance.id)
     eq_(instance.name, 'Gigabit app')
     ok_(instance.slug)
     eq_(instance.owner, user)
     eq_(instance.status, models.Application.DRAFT)
     eq_(instance.stage, models.Application.IDEA)
     eq_(instance.website, '')
     eq_(instance.image, '')
     eq_(instance.summary, '')
     eq_(instance.impact_statement, '')
     eq_(instance.assistance, '')
     eq_(instance.team_description, '')
     eq_(instance.acknowledgments, '')
     eq_(instance.notes, '')
     ok_(instance.created)
     ok_(instance.modified)
     eq_(instance.is_featured, False)
     eq_(list(instance.features.all()), [])
     eq_(instance.features_other, '')
     eq_(instance.domain, None)
     eq_(list(instance.members.all()), [])
     eq_(list(instance.tags.all()), [])
     eq_(instance.team_name, '')
     eq_(instance.awards, '')
开发者ID:jendc123,项目名称:us_ignite,代码行数:31,代码来源:models_tests.py


示例16: test_instance_is_submitted

 def test_instance_is_submitted(self):
     user = get_user('us-ignite')
     challenge = fixtures.get_challenge(user=user)
     application = get_application(owner=user)
     entry = fixtures.get_entry(
         application, challenge=challenge, status=Entry.SUBMITTED)
     eq_(entry.is_submitted(), True)
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py


示例17: test_valid_payload_succeeds

 def test_valid_payload_succeeds(self):
     user = get_user('us-ignite')
     challenge = fixtures.get_challenge(
         user=user, status=Challenge.PUBLISHED)
     app = get_application(owner=user, status=Application.PUBLISHED)
     question = fixtures.get_question(challenge)
     entry = fixtures.get_entry(app)
     EntryAnswer.get_or_create_answer(
         entry, question, 'Uses Gigabit features.')
     question_id = 'question_%s' % question.id
     data = {
         'status': Entry.SUBMITTED,
         question_id: 'Answer for the question!'
     }
     url = '/challenges/%s/enter/%s/' % (challenge.slug, app.slug)
     request = utils.get_request('post', url, data=data, user=user)
     request._messages = utils.TestMessagesBackend(request)
     response = views.challenge_entry(
         request, challenge.slug, app.slug)
     eq_(response.status_code, 302)
     eq_(response['location'], url)
     entry = Entry.objects.get_entry_or_none(challenge, app)
     values = entry.entryanswer_set.values('answer', 'question_id').all()
     expected = [{
         'answer': 'Answer for the question!',
         'question_id': question.id
     }]
     eq_(list(values), expected)
开发者ID:jendc123,项目名称:us_ignite,代码行数:28,代码来源:views_tests.py


示例18: test_event_is_created_successfully

 def test_event_is_created_successfully(self):
     user = get_user('us-ignite')
     startdatetime = timezone.now()
     data = {
         'name': 'Gigabit community meet-up',
         'address': 'London, UK',
         'start_datetime': startdatetime,
         'user': user,
     }
     instance = models.Event.objects.create(**data)
     ok_(instance.id)
     eq_(instance.name, 'Gigabit community meet-up')
     ok_(instance.slug)
     eq_(instance.status, models.Event.PUBLISHED)
     eq_(instance.image, '')
     eq_(instance.description, '')
     eq_(instance.start_datetime, startdatetime)
     eq_(instance.end_datetime, None)
     eq_(instance.address, 'London, UK')
     eq_(instance.contact, None)
     eq_(instance.scope, models.Event.NATIONAL)
     eq_(list(instance.audiences.all()), [])
     eq_(instance.website, '')
     eq_(instance.tickets_url, '')
     eq_(list(instance.tags.all()), [])
     eq_(list(instance.hubs.all()), [])
     eq_(instance.user, user)
     eq_(instance.is_featured, False)
     eq_(instance.is_ignite, False)
     eq_(instance.notes, '')
     ok_(instance.created)
     ok_(instance.modified)
     ok_(instance.position)
     eq_(instance.audience_other, '')
开发者ID:jendc123,项目名称:us_ignite,代码行数:34,代码来源:models_tests.py


示例19: test_create_basic_profile_is_successful

 def test_create_basic_profile_is_successful(self):
     user = fixtures.get_user('john')
     data = {
         'user': user,
     }
     profile = Profile.objects.create(**data)
     ok_(profile.pk)
开发者ID:benrito,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py


示例20: test_get_absolute_url_double_digit_month

 def test_get_absolute_url_double_digit_month(self):
     author = get_user('us-ignite')
     naive = datetime(2012, 10, 3, 1, 30)
     publication_date = naive.replace(tzinfo=timezone.utc)
     post = fixtures.get_post(
         author=author, publication_date=publication_date, slug='gigabit-a')
     eq_(post.get_absolute_url(), '/blog/2012/10/gigabit-a/')
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python usage.cluster函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_user_mock函数代码示例发布时间: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