See image: test_image.png
'
media_type = content_api.get_or_create_media_type("image/png")
- test_content = content_api.get_or_create_file_content(
+ test_media = content_api.get_or_create_file_media(
self.learning_package.id,
media_type.id,
data=b"fake_image_data",
created=timezone.now(),
)
- content_by_filename = {"test_image.png": test_content.id}
+ content_by_filename = {"test_image.png": test_media.id}
context = self._make_migration_context(content_by_filename=content_by_filename)
result, reason = _migrate_component(
context=context,
@@ -423,11 +423,11 @@ def test_migrate_component_with_static_content(self):
self.assertIsNotNone(result)
self.assertIsNone(reason)
- component_content = result.componentversion.componentversioncontent_set.filter(
+ component_media = result.componentversion.componentversionmedia_set.filter(
key="static/test_image.png"
).first()
- self.assertIsNotNone(component_content)
- self.assertEqual(component_content.content_id, test_content.id)
+ self.assertIsNotNone(component_media)
+ self.assertEqual(component_media.media.id, test_media.id)
def test_migrate_skip_repeats(self):
"""
@@ -638,13 +638,13 @@ def test_migrate_component_content_filename_not_in_olx(self):
olx = '