def test_transform_is_public(self): """ `CanvasContentMetadataExporter``'s ``transform_is_public_view` returns True. """ content_metadata_item = GENERIC_CONTENT_METADATA_ITEM exporter = CanvasContentMetadataExporter('fake-user', self.config) assert exporter.transform_is_public(content_metadata_item) is True
def test_transform_description_includes_url(self, content_metadata_item, expected_description): """ ``CanvasContentMetadataExporter``'s ``transform_description`` returns correct syllabus_body """ exporter = CanvasContentMetadataExporter('fake-user', self.config) description = exporter.transform_description(content_metadata_item) assert description == expected_description
def test_transform_default_view(self): """ `CanvasContentMetadataExporter``'s ``transform_default_view` returns syllabus as value. """ content_metadata_item = GENERIC_CONTENT_METADATA_ITEM exporter = CanvasContentMetadataExporter('fake-user', self.config) assert exporter.transform_default_view(content_metadata_item) == 'syllabus'
def test_content_exporter_export(self, mock_get_content_metadata): """ ``CanvasContentMetadataExporter``'s ``export`` produces the expected export. """ mock_get_content_metadata.return_value = get_fake_content_metadata() exporter = CanvasContentMetadataExporter('fake-user', self.config) content_items = exporter.export() assert sorted(list(content_items.keys())) == sorted([ 'edX+DemoX', 'course-v1:edX+DemoX+Demo_Course', FAKE_UUIDS[3], ]) for item in content_items.values(): self.assertTrue( set(['syllabus_body', 'default_view', 'name']).issubset(set(item.channel_metadata.keys())))
def get_content_metadata_exporter(self, user): return CanvasContentMetadataExporter(user, self)