Ejemplo n.º 1
0
    def setUp(self):
        """Create a user and personal timetable."""
        self.user = create_user(username="******", password="******")
        self.student = create_student(user=self.user)
        self.sem = Semester.objects.create(name="Winter", year="1995")

        course = Course.objects.create(id=1,
                                       school="uoft",
                                       code="SEM101",
                                       name="Intro")
        section = Section.objects.create(id=1,
                                         course=course,
                                         semester=self.sem,
                                         meeting_section="L1")
        Offering.objects.create(
            id=1,
            section=section,
            day="M",
            date_start="08-29-1995",
            date_end="12-10-1995",
            time_start="8:00",
            time_end="10:00",
        )
        tt = PersonalTimetable.objects.create(name="tt",
                                              school="uoft",
                                              semester=self.sem,
                                              student=self.student)
        tt.courses.add(course)
        tt.sections.add(section)
        tt.save()

        self.factory = APIRequestFactory()
Ejemplo n.º 2
0
 def setUp(self):
     """Create a user and course."""
     self.user = create_user(username="******", password="******")
     self.student = create_student(user=self.user)
     self.course = Course.objects.create(id=1,
                                         school="uoft",
                                         code="SEM101",
                                         name="Intro")
     self.title = Reaction.REACTION_CHOICES[0][0]
     self.factory = APIRequestFactory()
Ejemplo n.º 3
0
 def setUpAuth(self):
     self.user = create_user()
     self.student = create_student(self.user)
Ejemplo n.º 4
0
 def setUp(self):
     self.user = create_user(username="******", password="******")
     self.student = create_student(user=self.user)
     self.factory = APIRequestFactory()
Ejemplo n.º 5
0
    def setUp(self):
        # set up friends
        self.user1 = create_user(first_name="jacob",
                                 last_name="D",
                                 username="******",
                                 password="******")
        self.student1 = create_student(id=1,
                                       user=self.user1,
                                       social_courses=True,
                                       social_all=True)

        self.user2 = create_user(first_name="tim",
                                 last_name="F",
                                 username="******",
                                 password="******")
        self.student2 = create_student(id=2,
                                       user=self.user2,
                                       social_courses=True,
                                       social_all=True)

        self.user3 = create_user(first_name="matt",
                                 last_name="A",
                                 username="******",
                                 password="******")
        self.student3 = create_student(id=3,
                                       user=self.user3,
                                       social_courses=True,
                                       social_all=True)

        # 1 and 2 are friends
        self.student2.friends.add(self.student1)
        self.student2.save()
        self.student1.friends.add(self.student2)
        self.student2.save()

        # set up course with two sections
        sem = Semester.objects.create(name="Fall", year="2000")
        course = Course.objects.create(id=1,
                                       school="uoft",
                                       code="SEM101",
                                       name="Intro")
        section1 = Section.objects.create(course=course,
                                          semester=sem,
                                          meeting_section="L1")
        Offering.objects.create(
            section=section1,
            day="M",
            date_start="08-29-2000",
            date_end="12-10-2000",
            time_start="8:00",
            time_end="10:00",
            is_short_course=False,
        )

        section2 = Section.objects.create(course=course,
                                          semester=sem,
                                          meeting_section="L2")
        Offering.objects.create(
            section=section2,
            day="W",
            date_start="08-29-2000",
            date_end="12-10-2000",
            time_start="8:00",
            time_end="10:00",
            is_short_course=False,
        )

        # students have a timetable in common
        tt1 = PersonalTimetable.objects.create(name="tt",
                                               school="uoft",
                                               semester=sem,
                                               student=self.student1)
        tt1.courses.add(course)
        tt1.sections.add(section1)
        tt1.save()

        tt2 = PersonalTimetable.objects.create(name="tt",
                                               school="uoft",
                                               semester=sem,
                                               student=self.student2)
        tt2.courses.add(course)
        tt2.sections.add(section1)
        tt2.save()

        tt3 = PersonalTimetable.objects.create(name="tt",
                                               school="uoft",
                                               semester=sem,
                                               student=self.student3)
        tt3.courses.add(course)
        tt3.sections.add(section1)
        tt3.save()

        # student2 has another timetable
        tt4 = PersonalTimetable.objects.create(name="tt",
                                               school="uoft",
                                               semester=sem,
                                               student=self.student2)
        tt4.courses.add(course)
        tt4.sections.add(section2)
        tt4.save()

        self.factory = APIRequestFactory()