本文整理汇总了Python中us_ignite.profiles.tests.fixtures.get_user函数的典型用法代码示例。如果您正苦于以下问题:Python get_user函数的具体用法?Python get_user怎么用?Python get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))
示例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()
示例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))
示例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)
示例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/')
示例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')
示例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)
示例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()
示例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)
示例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')
示例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())
示例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)])
示例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)
示例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)
示例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, '')