Beispiel #1
0
 def test_should_dump_course(self, last_command_run, last_course_published, should_dump):
     """
     Tests whether a course should be dumped given the last time it was
     dumped and the last time it was published.
     """
     mss = ModuleStoreSerializer()
     mss.get_command_last_run = lambda course_key, graph: last_command_run
     mss.get_course_last_published = lambda course_key: last_course_published
     mock_course_key = mock.Mock
     mock_graph = mock.Mock()
     self.assertEqual(
         mss.should_dump_course(mock_course_key, mock_graph),
         should_dump,
     )
Beispiel #2
0
    def test_coerce_types_iterable(self, iterable_type):
        """
        Tests the coerce_types helper method for iterable types
        """
        example_iterable = iterable_type([object, object, object])

        # each element in the iterable is not unicode:
        self.assertFalse(
            any(isinstance(tab, six.text_type) for tab in example_iterable))
        # but after they are coerced, they are:
        coerced = ModuleStoreSerializer().coerce_types(example_iterable)
        self.assertTrue(all(isinstance(tab, six.text_type) for tab in coerced))
        # finally, make sure we haven't changed the type:
        self.assertEqual(type(coerced), iterable_type)
 def setUpClass(cls):
     """Any ModuleStore course/content operations can go here."""
     super(TestModuleStoreSerializer, cls).setUpClass()
     cls.mss = ModuleStoreSerializer.create()
 def setUpClass(cls):
     """Any ModuleStore course/content operations can go here."""
     super(TestModuleStoreSerializer, cls).setUpClass()
     cls.mss = ModuleStoreSerializer.create()