class TestAddCourseToInterViewerCourses(TestCase): def setUp(self): self.interviewer = InterviewerFactory() self.course = CourseFactory() def test_service_raises_validation_error_when_course_does_not_have_app_info(self): with self.assertRaises(ValidationError): add_course_to_interviewer_courses(interviewer=self.interviewer, course=self.course) def test_service_adds_course_to_interviewer_courses_when_course_has_app_info(self): current_course_count = self.interviewer.courses_to_interview.count() ApplicationInfoFactory(course=self.course) self.course.refresh_from_db() add_course_to_interviewer_courses(interviewer=self.interviewer, course=self.course) self.assertEqual(current_course_count + 1, self.interviewer.courses_to_interview.count())
def setUp(self): self.course = CourseFactory() self.app_info = ApplicationInfoFactory( course=self.course, start_date=timezone.now().date(), end_date=timezone.now().date() + timezone.timedelta(days=1)) self.user = BaseUserFactory()
def setUp(self): self.start_date = faker.date_object() self.end_date = faker.date_object() self.course = CourseFactory(start_date=timezone.now().date(), end_date=timezone.now().date() + timezone.timedelta(days=1)) self.start_interview_date = faker.date_object() self.end_interview_date = faker.date_object()
def setUp(self): self.user = BaseUserFactory() self.user.is_active = True self.user.save() self.request = Mock() self.request.user = self.user self.course = CourseFactory() self.view = make_mock_object() self.view.kwargs = {'course_id': self.course.id}
def test_course_end_date_cannot_be_before_start_date(self): start_date = get_now() end_date = get_now() - timedelta(days=1) course_data = CourseFactory.build() course_data['start_date'] = start_date course_data['end_date'] = end_date course = Course(**course_data) with self.assertRaises(ValidationError): course.full_clean()
def setUp(self): self.user = BaseUserFactory() self.course = CourseFactory(start_date=timezone.now() + timezone.timedelta(days=5)) self.application_info = ApplicationInfoFactory( course=self.course, start_date=timezone.now() - timezone.timedelta(days=5), end_date=timezone.now() - timezone.timedelta(days=4), start_interview_date=timezone.now() - timezone.timedelta(days=3), end_interview_date=timezone.now() + timezone.timedelta(days=4) ) self.interviewer = Interviewer.objects.create_from_user(self.user) self.interviewer.courses_to_interview.add(self.application_info) self.interviewer.save()
def setUp(self): self.interviewer = InterviewerFactory() self.course = CourseFactory()
def setUp(self): self.user = BaseUserFactory() self.course = CourseFactory() self.application_info = ApplicationInfoFactory(course=self.course) self.application = ApplicationFactory( application_info=self.application_info, user=self.user)