def test_post_redirects_when_user_has_already_applied(self):
self.app_info.start_date = timezone.now().date()
self.app_info.end_date = timezone.now().date() + timezone.timedelta(days=2)
self.app_info.save()
data = {
'phone': faker.phone_number(),
'works_at': faker.job(),
'skype': faker.word()
}
create_application(user=self.user, application_info=self.app_info, skype=data.get('skype'))
with self.login(email=self.user.email, password=self.test_password):
response = self.post(self.url, data=data)
expected_url = reverse('dashboard:applications:user-applications')
self.assertRedirects(response,
expected_url=expected_url)
评论列表
文章目录