예제 #1
0
파일: tests.py 프로젝트: ralokt/aurora
 def create_course(self):
     self.course = Course(
         title='test_title',
         short_title='test_short_title',
         description='test_description',
         course_number='test_course_number',
     )
     self.course.save()
     for user in self.users:
         CourseUserRelation(course=self.course, user=user).save()
예제 #2
0
파일: tests.py 프로젝트: ralokt/aurora
 def test_user_is_enlisted(self):
     # created users should be enlisted in to the course
     assert self.course.user_is_enlisted(self.users[0])
     # created users should not be enlisted in any course yet
     user = self.create_test_user("test_user")
     course1 = self.course
     course2 = Course(
         title='test_title2',
         short_title='test_short_title2',
         description='test_description2',
         course_number='test_course_number2',
     )
     course2.save()
     assert not course1.user_is_enlisted(user)
     assert not course2.user_is_enlisted(user)
     # user should be enlisted in course1
     CourseUserRelation(course=course1, user=user).save()
     assert course1.user_is_enlisted(user)
     assert not course2.user_is_enlisted(user)
     # user should be enlisted in both courses
     CourseUserRelation(course=course2, user=user).save()
     assert course1.user_is_enlisted(user)
     assert course2.user_is_enlisted(user)