コード例 #1
0
 def setUp(self):
     self.department_cs = Department(long_name='Computer Science',
                                     short_name='CS',
                                     abbreviation='COMP SCI')
     self.department_cs.save()
     self.department_me = Department(long_name='Mechanical Engineering',
                                     short_name='ME',
                                     abbreviation='MEC ENG')
     self.department_me.save()
     self.course_cs1 = Course(department=self.department_cs, number='1')
     self.course_cs1.save()
     self.course_me50 = Course(department=self.department_me, number='50')
     self.course_me50.save()
     self.instructor_test = Instructor(first_name='Tau',
                                       last_name='Bate',
                                       department=self.department_cs)
     self.instructor_test.save()
     self.term_test = Term(term=Term.SPRING, year=2013, current=True)
     self.term_test.save()
     self.user_test = get_user_model().objects.create_user(
         username='******',
         email='tbp.berkeley.edu',
         password='******',
         first_name='Tau',
         last_name='Bate')
     self.user_test.save()
コード例 #2
0
    def setUp(self):
        self.test_exam1 = make_test_exam(10000)
        self.test_exam2 = make_test_exam(20000)
        self.test_exam3 = make_test_exam(30000)

        self.permission1 = InstructorPermission.objects.get(pk=100000)
        self.permission2 = InstructorPermission.objects.get(pk=200000)
        self.permission3 = InstructorPermission.objects.get(pk=300000)

        self.dept_cs = Department(long_name='Computer Science',
                                  short_name='CS',
                                  abbreviation='COMPSCI')
        self.dept_cs.save()
        self.course_cs_1 = Course(department=self.dept_cs, number='1')
        self.course_cs_1.save()
        self.instructor_cs = Instructor(first_name='Tau',
                                        last_name='Bate',
                                        department=self.dept_cs)
        self.instructor_cs.save()
        self.term = Term(term='sp', year=2016, current=True)
        self.term.save()
        self.course_instance_cs_1 = CourseInstance(term=self.term,
                                                   course=self.course_cs_1)
        self.course_instance_cs_1.save()
        self.course_instance_cs_1.instructors.add(self.instructor_cs)
        self.course_instance_cs_1.save()

        self.permission4 = InstructorPermission(instructor=self.instructor_cs,
                                                permission_allowed=True)
        self.permission4.save()
コード例 #3
0
ファイル: tests.py プロジェクト: ericdwang/quark
 def setUp(self):
     self.test_department = make_test_department()
     self.test_department_2 = Department(long_name='Test Department 2',
                                         short_name='Tst Dep 2',
                                         abbreviation='TEST DEPT 2')
     self.test_department_2.save()
     self.test_course_1 = Course(department=self.test_department,
                                 number='61a',
                                 title='TestDept1 61a')
     self.test_course_1.save()
     self.test_course_2 = Course(department=self.test_department,
                                 number='h61a',
                                 title='Honors TestDept1 61a')
     self.test_course_2.save()
     self.test_course_3 = Course(department=self.test_department,
                                 number='61b',
                                 title='TestDept1 61b')
     self.test_course_3.save()
     self.test_course_4 = Course(department=self.test_department,
                                 number='70',
                                 title='TestDept1 70')
     self.test_course_4.save()
     self.test_course_5 = Course(department=self.test_department_2,
                                 number='C30',
                                 title='TestDept2 C30')
     self.test_course_5.save()
     self.test_course_6 = Course(department=self.test_department_2,
                                 number='70',
                                 title='TestDept2 70')
     self.test_course_6.save()
     self.test_course_7 = Course(department=self.test_department_2,
                                 number='130AC',
                                 title='TestDept2 130AC')
     self.test_course_7.save()
     self.test_course_8 = Course(department=self.test_department_2,
                                 number='C130AC',
                                 title='TestDept2 C130AC')
     self.test_course_8.save()
     self.test_course_9 = Course(department=self.test_department_2,
                                 number='H130AC',
                                 title='TestDept2 Honors 130AC')
     self.test_course_9.save()
コード例 #4
0
ファイル: tests.py プロジェクト: ericdwang/quark
 def setUp(self):
     self.dept_cs = Department(long_name='Computer Science',
                               short_name='CS',
                               abbreviation='COMPSCI')
     self.dept_cs.save()
     self.dept_ee = Department(long_name='Electrical Engineering',
                               short_name='EE',
                               abbreviation='EL ENG')
     self.dept_ee.save()
     self.course_cs_1 = Course(department=self.dept_cs, number='1')
     self.course_cs_1.save()
     self.course_ee_1 = Course(department=self.dept_ee, number='1')
     self.course_ee_1.save()
     self.instructor_cs = Instructor(first_name='Tau',
                                     last_name='Bate',
                                     department=self.dept_cs)
     self.instructor_cs.save()
     self.instructor_ee = Instructor(first_name='Pi',
                                     last_name='Bent',
                                     department=self.dept_ee)
     self.instructor_ee.save()
     self.term = Term(term='sp', year=2013, current=True)
     self.term.save()
     self.course_instance_cs_1 = CourseInstance(term=self.term,
                                                course=self.course_cs_1)
     self.course_instance_cs_1.save()
     self.course_instance_cs_1.instructors.add(self.instructor_cs)
     self.course_instance_cs_1.save()
     self.course_instance_ee_1 = CourseInstance(term=self.term,
                                                course=self.course_ee_1)
     self.course_instance_ee_1.save()
     self.course_instance_ee_1.instructors.add(self.instructor_ee)
     self.course_instance_ee_1.save()
     self.user = get_user_model().objects.create_user(
         username='******',
         email='tbp.berkeley.edu',
         password='******',
         first_name='tbp',
         last_name='user')
     self.user.save()
     self.survey_cs_1 = Survey(course=self.course_cs_1,
                               term=self.term,
                               instructor=self.instructor_cs,
                               prof_rating=5,
                               course_rating=5,
                               time_commitment=5,
                               comments='Test comments',
                               submitter=self.user,
                               published=True)
     self.survey_cs_1.save()
     self.survey_cs_1_b = Survey(course=self.course_cs_1,
                                 term=self.term,
                                 instructor=self.instructor_cs,
                                 prof_rating=0,
                                 course_rating=5,
                                 time_commitment=0,
                                 comments='Test comments',
                                 submitter=self.user,
                                 published=True)
     self.survey_cs_1_b.save()
     self.exam_ee_1 = Exam(course_instance=self.course_instance_ee_1,
                           submitter=self.user,
                           exam_number=Exam.FINAL,
                           exam_type=Exam.EXAM,
                           file_ext='.pdf',
                           verified=True)
     self.exam_ee_1.save()
コード例 #5
0
ファイル: tests.py プロジェクト: ochan1/quark
 def setUp(self):
     self.dept_cs = Department(long_name='Computer Science',
                               short_name='CS',
                               abbreviation='COMPSCI')
     self.dept_cs.save()
     self.dept_ee = Department(long_name='Electrical Engineering',
                               short_name='EE',
                               abbreviation='EL ENG')
     self.dept_ee.save()
     self.course_cs_1 = Course(department=self.dept_cs, number='1')
     self.course_cs_1.save()
     self.course_ee_1 = Course(department=self.dept_ee, number='1')
     self.course_ee_1.save()
     self.instructor_cs = Instructor(first_name='Tau',
                                     last_name='Bate',
                                     department=self.dept_cs)
     self.instructor_cs.save()
     self.instructor_ee = Instructor(first_name='Pi',
                                     last_name='Bent',
                                     department=self.dept_ee)
     self.instructor_ee.save()
     self.instructor_ee_2 = Instructor(first_name='Bau',
                                       last_name='Tate',
                                       department=self.dept_ee)
     self.instructor_ee_2.save()
     self.term = Term(term='sp', year=2013, current=True)
     self.term.save()
     self.term2 = Term(term='sp', year=2014, current=False)
     self.term2.save()
     self.course_instance_cs_1 = CourseInstance(term=self.term,
                                                course=self.course_cs_1)
     self.course_instance_cs_1.save()
     self.course_instance_cs_1.instructors.add(self.instructor_cs)
     self.course_instance_cs_1.save()
     self.course_instance_ee_1 = CourseInstance(term=self.term,
                                                course=self.course_ee_1)
     self.course_instance_ee_1.save()
     self.course_instance_ee_1.instructors.add(self.instructor_ee)
     self.course_instance_ee_1.save()
     self.course_instance_ee_2 = CourseInstance(term=self.term2,
                                                course=self.course_ee_1)
     self.course_instance_ee_2.save()
     self.course_instance_ee_2.instructors.add(self.instructor_ee)
     self.course_instance_ee_2.save()
     self.course_instance_ee_3 = CourseInstance(term=self.term2,
                                                course=self.course_ee_1)
     self.course_instance_ee_3.save()
     self.course_instance_ee_3.instructors.add(self.instructor_ee_2)
     self.course_instance_ee_3.save()
     self.user = get_user_model().objects.create_user(
         username='******',
         email='tbp.berkeley.edu',
         password='******',
         first_name='tbp',
         last_name='user')
     self.user.save()
     self.syllabus_cs_1 = Syllabus(
         course_instance=self.course_instance_cs_1,
         submitter=self.user,
         file_ext='.pdf',
         verified=True)
     self.syllabus_cs_1.save()
     # Create exams:
     # ee_1: Course ee1, instr 1 final exam
     # ee_2: Course ee1, instr 1 final solution
     # ee_3: Course ee1, instr 1 final exam
     # ee_4: Course ee1, instr 2 final exam
     self.exam_ee_1 = Exam(course_instance=self.course_instance_ee_1,
                           submitter=self.user,
                           exam_number=Exam.FINAL,
                           exam_type=Exam.EXAM,
                           file_ext='.pdf',
                           verified=True)
     self.exam_ee_1.save()
     self.exam_ee_2 = Exam(course_instance=self.course_instance_ee_1,
                           submitter=self.user,
                           exam_number=Exam.FINAL,
                           exam_type=Exam.SOLN,
                           file_ext='.pdf',
                           verified=True)
     self.exam_ee_2.save()
     self.exam_ee_3 = Exam(course_instance=self.course_instance_ee_2,
                           submitter=self.user,
                           exam_number=Exam.FINAL,
                           exam_type=Exam.EXAM,
                           file_ext='.pdf',
                           verified=True)
     self.exam_ee_3.save()
     self.exam_ee_4 = Exam(course_instance=self.course_instance_ee_3,
                           submitter=self.user,
                           exam_number=Exam.FINAL,
                           exam_type=Exam.EXAM,
                           file_ext='.pdf',
                           verified=True)
     self.exam_ee_4.save()