本文整理汇总了Python中tests.utils.subdomain_get函数的典型用法代码示例。如果您正苦于以下问题:Python subdomain_get函数的具体用法?Python subdomain_get怎么用?Python subdomain_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subdomain_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_can_only_rate_own_company_opening
def test_can_only_rate_own_company_opening(self):
application = ApplicationFactory(opening=self.opening)
other_user = UserFactory()
url = reverse(
'applications:rate', args=(application.pk, -1,)
)
subdomain_get(self.app, url, other_user, status=404)
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例2: test_promote_to_admin_different_company
def test_promote_to_admin_different_company(self):
admin = UserFactory(is_company_admin=True)
user = UserFactory()
url = reverse('accounts:promote', kwargs={'user_pk': user.id})
subdomain_get(self.app, url, user=admin, status=404)
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例3: test_publish_another_company_opening
def test_publish_another_company_opening(self):
opening = OpeningFactory(
company=self.user.company, published_date=datetime.now()
)
user2 = UserFactory()
url = reverse('openings:publish_opening', args=(opening.id,))
subdomain_get(self.app, url, user=user2, status=404)
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例4: test_promote_to_admin_without_being_admin
def test_promote_to_admin_without_being_admin(self):
fake_admin = UserFactory()
user = UserFactory(company=fake_admin.company)
url = reverse('accounts:promote', kwargs={'user_pk': user.id})
subdomain_get(self.app, url, user=fake_admin, status=404)
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例5: test_unpublish_opening
def test_unpublish_opening(self):
opening = OpeningFactory(
company=self.user.company, published_date=datetime.now()
)
url = reverse('openings:publish_opening', args=(opening.id,))
subdomain_get(self.app, url, user=self.user)
self.assertIsNone(Opening.objects.get().published_date)
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
示例6: test_promote_to_admin_valid
def test_promote_to_admin_valid(self):
admin = UserFactory(is_company_admin=True)
user = UserFactory(company=admin.company)
url = reverse('accounts:promote', kwargs={'user_pk': user.id})
subdomain_get(self.app, url, user=admin)
self.assertTrue(CustomUser.objects.get(id=user.id).is_company_admin)
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
示例7: test_get_applicant_details_different_company
def test_get_applicant_details_different_company(self):
application = ApplicationFactory(opening=self.opening)
user = UserFactory(email='[email protected]')
url = reverse(
'applications:application_detail', args=(application.id,)
)
subdomain_get(self.app, url, user=user, status=404)
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
示例8: test_delete_user_valid
def test_delete_user_valid(self):
admin = UserFactory(is_company_admin=True)
user = UserFactory(company=admin.company)
url = reverse('accounts:delete', kwargs={'user_pk': user.id})
subdomain_get(self.app, url, user=admin)
self.assertEqual(len(CustomUser.objects.filter(id=user.id)), 0)
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
示例9: test_close_opening_valid
def test_close_opening_valid(self):
opening = OpeningFactory(title='DevOps', company=self.user.company)
url = reverse('openings:publish_opening', args=(opening.id,))
subdomain_get(self.app, url, user=self.user)
self.assertEqual(
Opening.objects.filter(published_date__isnull=True).count(), 0
)
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
示例10: test_get_logout_while_logged_out
def test_get_logout_while_logged_out(self):
"""
GET the logout view while logged out
Should redirect to the home page since it's not allowed to access this
page without being logged in
"""
subdomain_get(self.app, reverse('auth:logout'))
self.assertTemplateUsed('accounts/login.html')
开发者ID:hizardapp,项目名称:Hizard,代码行数:9,代码来源:test_views.py
示例11: test_get_company
def test_get_company(self):
url = reverse("companies:create")
page = subdomain_get(self.app, url, user=self.user)
self.assertEqual(page.status_code, 200)
self.assertIn(0, page.forms)
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例12: test_hire_applicant
def test_hire_applicant(self):
InterviewStageFactory(tag='HIRED', company=CompanyFactory())
hired_stage = InterviewStageFactory(tag='HIRED',
company=self.user.company)
EmailTemplateFactory(code="candidate_hired",
company=self.user.company,
subject="Congrats {{ applicant_first_name }}")
application = ApplicationFactory(opening=self.opening)
url = reverse(
'applications:application_detail', args=(application.pk,)
)
response = subdomain_get(self.app, url, user=self.user)
form = response.forms['transition-form']
form['stage'] = '%s' % hired_stage.pk
response = form.submit().follow()
self.assertEqual(len(mail.outbox), 1)
email, = mail.outbox
self.assertTrue("Bilbon" in email.subject)
application = Application.objects.get(pk=application.pk)
self.assertEqual(application.current_stage, hired_stage)
transition = application.stage_transitions.get()
self.assertEqual(transition.user, self.user)
self.assertEqual(transition.stage, hired_stage)
开发者ID:hizardapp,项目名称:Hizard,代码行数:27,代码来源:test_views.py
示例13: test_get_demo_login_view
def test_get_demo_login_view(self):
response = subdomain_get(self.app, reverse('auth:login'),
data=dict(demo=1))
self.assertEqual(response.status_code, 200)
form = response.forms[0]
self.assertEqual(form['username'].value, "demo")
self.assertEqual(form['password'].value, "demo")
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例14: test_discuss_an_application
def test_discuss_an_application(self):
application = ApplicationFactory(opening=self.opening)
colleague = UserFactory(
email='[email protected]', company=self.user.company
)
url = reverse(
'applications:application_detail', args=(application.id,)
)
response = subdomain_get(self.app, url, user=self.user)
form = response.forms['new-message-form']
form['body'] = 'This guy is good'
form['parent'] = ''
response = form.submit().follow()
self.assertContains(response, "This guy is good")
parent_message = ApplicationMessage.objects.get()
self.assertEqual(self.user, parent_message.user)
form = response.forms['new-message-form']
form['body'] = "I beg to differ"
form['parent'] = parent_message.pk
response = form.submit(user=colleague).follow(user=colleague)
self.assertContains(response, "This guy is good")
self.assertContains(response, "I beg to differ")
new_message = ApplicationMessage.objects.get(parent=parent_message)
self.assertEqual(colleague, new_message.user)
开发者ID:hizardapp,项目名称:Hizard,代码行数:27,代码来源:test_views.py
示例15: test_post_password_confirm_failure_password_mismatch
def test_post_password_confirm_failure_password_mismatch(self):
"""
POST the reset password confirmation page
Should not change the password and shows the errors
"""
user = UserFactory()
uidb36 = int_to_base36(user.pk)
token = default_token_generator.make_token(user)
page = subdomain_get(
self.app,
reverse(
'auth:confirm_reset_password',
kwargs={
'uidb36': uidb36,
'token': token
}
)
)
form = page.forms[0]
form['new_password1'] = 'password'
form['new_password2'] = 'wrong'
response = form.submit()
user_found = CustomUser.objects.get()
self.assertContains(response, 'The two password fields')
self.assertFalse(user_found.check_password('password'))
self.assertTrue(user_found.check_password('bob'))
开发者ID:hizardapp,项目名称:Hizard,代码行数:28,代码来源:test_views.py
示例16: test_post_password_confirm_success
def test_post_password_confirm_success(self):
"""
POST the reset password confirmation page
Should change the password and redirects to home page
"""
user = UserFactory()
uidb36 = int_to_base36(user.pk)
token = default_token_generator.make_token(user)
page = subdomain_get(
self.app,
reverse(
'auth:confirm_reset_password',
kwargs={
'uidb36': uidb36,
'token': token
}
)
)
form = page.forms[0]
form['new_password1'] = 'password'
form['new_password2'] = 'password'
response = form.submit().follow()
user_found = CustomUser.objects.get()
self.assertTemplateUsed(response, 'accounts/login.html')
self.assertTrue(user_found.check_password('password'))
self.assertFalse(user_found.check_password('bob'))
开发者ID:hizardapp,项目名称:Hizard,代码行数:27,代码来源:test_views.py
示例17: test_already_logged_in
def test_already_logged_in(self):
"""
Testing that logged in users get redirected to the dashboard
"""
user = UserFactory()
response = subdomain_get(self.app, reverse('auth:login'), user=user)
self.assertTemplateUsed(response, 'dashboard/dashboard.html')
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例18: test_list_stages
def test_list_stages(self):
url = reverse('companysettings:list_stages')
stage = InterviewStageFactory(company=self.user.company)
page = subdomain_get(self.app, url, user=self.user)
self.assertContains(page, stage.name)
开发者ID:hizardapp,项目名称:Hizard,代码行数:7,代码来源:test_views.py
示例19: test_get_invalid_activation
def test_get_invalid_activation(self):
"""
GET the activation page with an invalid activation key
Should raise a 404, using client instead of app since app would fail
"""
url = reverse('accounts:activate', args=('FAKE',))
response = subdomain_get(self.app, url, status=404)
self.assertEqual(response.status_code, 404)
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
示例20: test_vote_application_invalid
def test_vote_application_invalid(self):
application = ApplicationFactory(opening=self.opening)
url = reverse(
'applications:rate', args=(application.pk, -42,)
)
page = subdomain_get(self.app, url, user=self.user)
self.assertTemplateUsed(page, 'applications/application_detail.html')
self.assertContains(page, 'class="alert-error"')
开发者ID:hizardapp,项目名称:Hizard,代码行数:8,代码来源:test_views.py
注:本文中的tests.utils.subdomain_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论