Skip to content

Commit

Permalink
add test for exportcontent --manifest-only command
Browse files Browse the repository at this point in the history
  • Loading branch information
thesujai committed Apr 11, 2024
1 parent af50fcb commit 808ba03
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions kolibri/core/content/test/test_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,36 @@ def test_local_cancel_during_transfer(
)
cancel_mock.assert_called_with()

@patch(
"kolibri.core.content.management.commands.exportcontent.Command.copy_content_files"
)
def test_manifest_only(
self,
copy_content_files_mock,
ContentManifestMock,
get_content_nodes_data_mock,
get_import_export_nodes_mock,
):
"""
Test case for the exportcontent management command with --manifest-only option.
"""
get_content_nodes_data_mock.return_value = (
1,
[LocalFile.objects.values("id", "file_size", "extension").first()],
10,
)

# run with manifest-only option
call_command(
"exportcontent", self.the_channel_id, tempfile.mkdtemp(), manifest_only=True
)

copy_content_files_mock.assert_not_called()

ContentManifestMock.return_value.write.assert_called_once()

# Shall be enough mock assertions for now ?


class TestFilesToTransfer(TestCase):

Expand Down

0 comments on commit 808ba03

Please sign in to comment.