本文整理汇总了Python中us_ignite.apps.tests.fixtures.get_application函数的典型用法代码示例。如果您正苦于以下问题:Python get_application函数的具体用法?Python get_application怎么用?Python get_application使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_application函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_non_published_applications_are_not_shown
def test_non_published_applications_are_not_shown(self):
fixtures.get_application(
name='Gigabit app', status=Application.DRAFT)
response = views.app_list(self.factory.get('/app/'))
eq_(response.status_code, 200)
eq_(len(response.context_data['page'].object_list), 0)
_teardown_apps()
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:views_tests.py
示例2: test_applications_are_reverse_sorted
def test_applications_are_reverse_sorted(self):
owner = get_user('us-ignite')
app_a = fixtures.get_application(
name='alpha app', status=Application.PUBLISHED, owner=owner)
app_b = fixtures.get_application(
name='beta app', status=Application.PUBLISHED, owner=owner)
response = views.app_list(self.factory.get('/app/', {'order': '-name'}))
eq_(list(response.context_data['page'].object_list), [app_b, app_a])
_teardown_apps()
开发者ID:jendc123,项目名称:us_ignite,代码行数:9,代码来源:views_tests.py
示例3: test_applications_are_listed_by_domain
def test_applications_are_listed_by_domain(self):
domain = fixtures.get_domain(name='foo')
owner = get_user('us-ignite')
app_a = fixtures.get_application(
name='alpha app', status=Application.PUBLISHED, owner=owner,
domain=domain)
fixtures.get_application(
name='beta app', status=Application.PUBLISHED, owner=owner)
response = views.app_list(self.factory.get('/app/foo/'), 'foo')
eq_(response.status_code, 200)
eq_(response.template_name, 'apps/object_list.html')
eq_(list(response.context_data['page'].object_list), [app_a])
_teardown_apps()
开发者ID:jendc123,项目名称:us_ignite,代码行数:13,代码来源:views_tests.py
示例4: 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
示例5: test_published_applications_are_listed
def test_published_applications_are_listed(self):
app = fixtures.get_application(
name='Gigabit app', status=Application.PUBLISHED)
response = views.app_list(self.factory.get('/app/'))
eq_(response.status_code, 200)
eq_(list(response.context_data['page'].object_list), [app])
_teardown_apps()
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:views_tests.py
示例6: 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
示例7: 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
示例8: test_is_not_visible_when_is_draft
def test_is_not_visible_when_is_draft(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.DRAFT)
eq_(entry.is_visible_by(utils.get_anon_mock()), False)
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py
示例9: test_is_visible_for_owners
def test_is_visible_for_owners(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.DRAFT)
eq_(entry.is_visible_by(user), True)
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py
示例10: 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
示例11: test_instance_is_draft
def test_instance_is_draft(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.DRAFT)
eq_(entry.is_draft(), True)
开发者ID:jendc123,项目名称:us_ignite,代码行数:7,代码来源:models_tests.py
示例12: 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
示例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_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
示例15: 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
示例16: test_edit_url
def test_edit_url(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.get_edit_url(),
'/challenges/%s/enter/%s/' % (challenge.slug, application.slug))
开发者ID:jendc123,项目名称:us_ignite,代码行数:8,代码来源:models_tests.py
示例17: 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
示例18: test_get_request_is_successful
def test_get_request_is_successful(self):
app = fixtures.get_application(
slug='alpha', status=Application.PUBLISHED, owner=self.user)
request = self.factory.get('/app/alpha/hubs/')
request.user = self.user
response = views.app_hub_membership(request, 'alpha')
eq_(response.status_code, 200)
eq_(response.template_name, 'apps/object_hub_membership.html')
eq_(sorted(response.context_data.keys()), ['form', 'object'])
eq_(response.context_data['object'], app)
开发者ID:jendc123,项目名称:us_ignite,代码行数:10,代码来源:views_tests.py
示例19: test_owner_membership_get_request_is_successful
def test_owner_membership_get_request_is_successful(self):
owner = get_user('owner')
app = fixtures.get_application(
slug='gamma', status=Application.PUBLISHED, owner=owner)
request = self.factory.get('/app/gamma/membership/')
request.user = owner
response = views.app_membership(request, 'gamma')
eq_(response.status_code, 200)
eq_(sorted(response.context_data.keys()),
['form', 'formset', 'object'])
eq_(response.context_data['object'], app)
self._teardown()
开发者ID:jendc123,项目名称:us_ignite,代码行数:12,代码来源:views_tests.py
示例20: test_application_url_creation
def test_application_url_creation(self):
user = get_user('app-owner')
application = fixtures.get_application(owner=user)
data = {
'application': application,
'url': 'http://us-ignite.org',
}
instance = models.ApplicationURL.objects.create(**data)
ok_(instance.id)
eq_(instance.application, application)
eq_(instance.name, '')
eq_(instance.url, 'http://us-ignite.org')
开发者ID:jendc123,项目名称:us_ignite,代码行数:12,代码来源:models_tests.py
注:本文中的us_ignite.apps.tests.fixtures.get_application函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论