Beispiel #1
0
 def test_baseuser_not_access_generate_interview(self):
     user = BaseUserFactory()
     user.is_active = True
     user.save()
     with self.login(username=user.email,
                     password=BaseUserFactory.password):
         response = self.get('interview_system:generate_interviews')
         self.assertEquals(response.status_code, 302)
Beispiel #2
0
 def test_access_choose_from_user_without_application(self):
     user_without_app = BaseUserFactory()
     user_without_app.is_active = True
     user_without_app.save()
     with self.login(username=user_without_app.email,
                     password=BaseUserFactory.password):
         response = self.get('interview_system:choose_interview',
                             self.application.id, self.interview.uuid)
         self.assertEqual(response.status_code, 404)
Beispiel #3
0
    def test_create_file_if_there_is_db(self):
        baseuser = BaseUserFactory()
        baseuser.is_active = True
        baseuser.save()
        student = BaseUser.objects.promote_to_student(baseuser)
        course = CourseFactory()

        CourseAssignmentFactory(course=course,
                                user=student)
        course1 = CourseFactory()
        course2 = CourseFactory()

        self.assertFalse(os.path.exists('working_ats.csv'))
        call_command('create_csv_with_all_workingats', "{}, {}".format(course1.id, course2.id))
        self.assertTrue(os.path.exists('working_ats.csv'))
Beispiel #4
0
    def test_teacher_can_see_student_list_only_for_his_course(self):
        teacher = BaseUser.objects.promote_to_teacher(self.baseuser)
        teacher.teached_courses = [self.course]

        baseuser3 = BaseUserFactory()
        baseuser3.is_active = True
        baseuser3.save()
        student = BaseUser.objects.promote_to_student(baseuser3)
        course2 = CourseFactory()
        course_assignment_for_baseuser3 = CourseAssignmentFactory(
            course=course2, user=student)

        with self.login(email=teacher.email,
                        password=BaseUserFactory.password):
            response = self.get('education:student-list',
                                course=self.course.id)
            self.assertEqual(response.status_code, 200)
            self.assertIn(self.course_assignment,
                          response.context['object_list'])
            self.assertNotIn(course_assignment_for_baseuser3,
                             response.context['object_list'])