示例#1
0
    def test_map_user_student_affiliation(self):
        affils = [self.user.username, self.course.group.name]
        self.assertEquals(self.user.groups.count(), 0)

        CourseGroupMapper.map(self.user, affils)
        self.assertEquals(self.user.groups.count(), 1)
        self.assertTrue(self.course.group in self.user.groups.all())
示例#2
0
    def test_map_user_group_does_not_exist(self):
        affils = [self.user.username,
                  'CUcourse_ENGLW3872:columbia.edu']
        self.assertEquals(self.user.groups.count(), 0)

        CourseGroupMapper.map(self.user, affils)
        self.assertEquals(self.user.groups.count(), 0)
示例#3
0
 def test_create_activatable_affil_empty_course_string(self):
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(self.user, '', 2016))
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(self.user, '', None))
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(None, '', None))
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(
             AnonymousUser(), '', 2016))
示例#4
0
 def test_create_activatable_affil_student_course_string(self):
     s = 't1.y2016.s001.cf1000.scnc.st.course:columbia.edu'
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(self.user, s, 2016))
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(self.user, s, None))
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(None, s, None))
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(
             AnonymousUser(), s, 2016))
示例#5
0
    def test_create_activatable_affil_faculty_course_string(self):
        s = 't1.y2016.s001.cf1000.scnc.fc.course:columbia.edu'
        aa = CourseGroupMapper.create_activatable_affil(self.user, s, 2016)
        self.assertIsNotNone(aa)
        self.assertEqual(aa.name, s)
        self.assertEqual(aa.user, self.user)

        self.assertIsNone(
            CourseGroupMapper.create_activatable_affil(self.user, s, 2017))
        self.assertIsNone(
            CourseGroupMapper.create_activatable_affil(self.user, s, None))
        self.assertIsNone(
            CourseGroupMapper.create_activatable_affil(None, s, None))
        self.assertIsNone(
            CourseGroupMapper.create_activatable_affil(
                AnonymousUser(), s, 2016))
示例#6
0
 def test_create_activatable_affil_misc_course_string(self):
     self.assertIsNone(
         CourseGroupMapper.create_activatable_affil(
             self.user, 'ALL_CU', 2016))
示例#7
0
    def test_map_user_uniremoved(self):
        affils = [self.user.username]
        self.assertEquals(self.user.groups.count(), 0)

        CourseGroupMapper.map(self.user, affils)
        self.assertEquals(self.user.groups.count(), 0)