Exemple #1
0
    def test_cache_raises_exception_if_discussion_id_not_cached(self):
        cache = CourseStructure.objects.get(course_id=self.course.id)
        cache.discussion_id_map_json = None
        cache.save()

        with self.assertRaises(utils.DiscussionIdMapIsNotCached):
            utils.get_cached_discussion_key(self.course, 'test_discussion_id')
Exemple #2
0
    def test_cache_raises_exception_if_discussion_id_not_cached(self):
        cache = CourseStructure.objects.get(course_id=self.course.id)
        cache.discussion_id_map_json = None
        cache.save()

        with self.assertRaises(utils.DiscussionIdMapIsNotCached):
            utils.get_cached_discussion_key(self.course, 'test_discussion_id')
Exemple #3
0
 def test_cache_raises_exception_if_course_structure_not_cached(self):
     CourseStructure.objects.all().delete()
     with self.assertRaises(utils.DiscussionIdMapIsNotCached):
         utils.get_cached_discussion_key(self.course, 'test_discussion_id')
Exemple #4
0
 def test_cache_returns_none_if_id_is_not_present(self):
     usage_key = utils.get_cached_discussion_key(self.course, 'bogus_id')
     self.assertIsNone(usage_key)
Exemple #5
0
 def test_cache_returns_correct_key(self):
     usage_key = utils.get_cached_discussion_key(self.course, 'test_discussion_id')
     self.assertEqual(usage_key, self.discussion.location)
Exemple #6
0
 def test_cache_raises_exception_if_course_structure_not_cached(self):
     CourseStructure.objects.all().delete()
     with self.assertRaises(utils.DiscussionIdMapIsNotCached):
         utils.get_cached_discussion_key(self.course, 'test_discussion_id')
Exemple #7
0
 def test_cache_returns_none_if_id_is_not_present(self):
     usage_key = utils.get_cached_discussion_key(self.course, 'bogus_id')
     self.assertIsNone(usage_key)
Exemple #8
0
 def test_cache_returns_correct_key(self):
     usage_key = utils.get_cached_discussion_key(self.course,
                                                 'test_discussion_id')
     self.assertEqual(usage_key, self.discussion.location)