import unittest
from pathlib import Path

from stage_post_import_payload import build_rsync_command


class StagePostImportPayloadTest(unittest.TestCase):
    def test_stage_command_targets_lanscratch_and_excludes_runtime_files(self):
        command = build_rsync_command(
            repo_root=Path("/repo"),
            target=Path("/opt/lanscratch/redmine-post-import/repo"),
        )

        self.assertIn("/opt/lanscratch/redmine-post-import/repo/", command)
        self.assertIn("/repo/plugins", command)
        self.assertIn("/repo/post_import_refresh.py", command)
        self.assertIn("/repo/stage_post_import_payload.py", command)
        self.assertIn("--exclude .env", command)
        self.assertIn("--exclude .venv", command)
        self.assertIn("--exclude .cache", command)
        self.assertIn("--exclude __pycache__/", command)
        self.assertIn("--exclude '*.tar.gz'", command)


if __name__ == "__main__":
    unittest.main()
