Example #1
0
    def handle(self, *args, **options):
        # Check if we have a semester
        try:
            semester = Semester.get_current()
            course = CourseFactory.create(semester = semester)
        except IndexError:
            course = CourseFactory.create()

        self.stdout.write('Created Course {}.\n'.format(course))

        assignment = AssignmentFactory.create(course = course)
        self.stdout.write('Created Assignment {}.\n'.format(assignment))

        faculty = FacultyFactory.create()
        course.faculty.add(faculty)
        self.stdout.write('Created Faculty {} and assigned to course.\n'.format(faculty))
        
        self.stdout.write('Successfully populated DB.\n')
Example #2
0
    def handle(self, *args, **options):
        # Check if we have a semester
        try:
            semester = Semester.get_current()
            course = CourseFactory.create(semester=semester)
        except IndexError:
            course = CourseFactory.create()

        self.stdout.write('Created Course {}.\n'.format(course))

        assignment = AssignmentFactory.create(course=course)
        self.stdout.write('Created Assignment {}.\n'.format(assignment))

        faculty = FacultyFactory.create()
        course.faculty.add(faculty)
        self.stdout.write(
            'Created Faculty {} and assigned to course.\n'.format(faculty))

        self.stdout.write('Successfully populated DB.\n')
Example #3
0
    def test_disable_faculty(self):
        """
        Tests if our tasks will disable inactive faculty
        """

        faculty = FacultyFactory.create()
        current_semester = SemesterFactory.create(end=datetime.now().date() - timedelta(days=1))
        next_semester = SemesterFactory.create(
            start=datetime.now().date() + timedelta(days=60), end=datetime.now().date() + timedelta(days=90)
        )

        current_course = CourseFactory.create(semester=current_semester)
        next_course = CourseFactory.create(semester=next_semester)

        current_course.faculty.add(faculty)

        disable_faculty()

        faculty = User.objects.get(username=faculty.username)
        self.assertEquals(faculty.is_active, False)
Example #4
0
    def test_disable_faculty(self):
        """
        Tests if our tasks will disable inactive faculty
        """

        faculty = FacultyFactory.create()
        current_semester = SemesterFactory.create(end=datetime.now().date() -
                                                  timedelta(days=1))
        next_semester = SemesterFactory.create(
            start=datetime.now().date() + timedelta(days=60),
            end=datetime.now().date() + timedelta(days=90))

        current_course = CourseFactory.create(semester=current_semester)
        next_course = CourseFactory.create(semester=next_semester)

        current_course.faculty.add(faculty)

        disable_faculty()

        faculty = User.objects.get(username=faculty.username)
        self.assertEquals(faculty.is_active, False)