Esempio n. 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')
Esempio n. 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')
Esempio n. 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')
Esempio n. 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)
Esempio n. 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)
Esempio n. 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')
Esempio n. 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)
Esempio n. 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)