def test_post_does_not_create_application_when_apply_is_closed(self):
self.app_info.start_date = timezone.now().date() - timezone.timedelta(days=2)
self.app_info.end_date = timezone.now().date() - timezone.timedelta(days=1)
self.app_info.save()
current_app_count = Application.objects.count()
data = {
'phone': faker.phone_number(),
'works_at': faker.job()
}
with self.login(email=self.user.email, password=self.test_password):
response = self.post(self.url, data=data)
self.assertFalse(response.context_data['form'].is_valid())
self.assertEqual(current_app_count, Application.objects.count())
评论列表
文章目录