"""Test write_thumbnail_locations_to_video_asset_table.""" from unittest.mock import call from video.constants import job_io_fields from video.logic.activities import ( write_thumbnail_locations_to_video_asset_table as activity) def test_write_thumbnail_locations_to_video_asset_table(mocker): """Test write_thumbnail_locations_to_video_asset_table.""" mocker.patch.object(activity, 'upsert_video_asset', autospec=True) activity.write_thumbnail_locations_to_video_asset_table({ job_io_fields.WRITE_THUMBNAIL_LOCATIONS_TO_VIDEO_ASSET_TABLE_JOB_ID: 123, job_io_fields.PRODUCT_ID: 1, job_io_fields.VIDEO_IMAGE_S2: '/s2', job_io_fields.VIDEO_IMAGE_S5: '/s5', job_io_fields.VIDEO_IMAGE_S10: '/s10', job_io_fields.VIDEO_IMAGE_S11: '/s11', }) activity.upsert_video_asset.assert_has_calls([ call({ 'product_id': 1, 'asset_type': job_io_fields.VIDEO_IMAGE_S2, 'asset_path': '/s2', }), call({ 'product_id': 1, 'asset_type': job_io_fields.VIDEO_IMAGE_S5, 'asset_path': '/s5', }), call({ 'product_id': 1, 'asset_type': job_io_fields.VIDEO_IMAGE_S10, 'asset_path': '/s10', }), call({ 'product_id': 1, 'asset_type': job_io_fields.VIDEO_IMAGE_S11, 'asset_path': '/s11', }), ]) def test_default_write_thumbnail_locations_to_video_asset_table(mocker): """Test default write_thumbnail_locations_to_video_asset_table.""" mocker.patch.object(activity, 'upsert_video_asset', autospec=True) activity.write_thumbnail_locations_to_video_asset_table({ job_io_fields.WRITE_THUMBNAIL_LOCATIONS_TO_VIDEO_ASSET_TABLE_JOB_ID: 123, job_io_fields.PRODUCT_ID: 1, job_io_fields.VIDEO_IMAGE_S2: '/s2', job_io_fields.VIDEO_IMAGE_S5: '/s5', }) activity.upsert_video_asset.assert_has_calls([ call({ 'product_id': 1, 'asset_type': job_io_fields.VIDEO_IMAGE_S2, 'asset_path': '/s2', }), call({ 'product_id': 1, 'asset_type': job_io_fields.VIDEO_IMAGE_S5, 'asset_path': '/s5', }), ])