feat(create): scaffold repositories via templates with preview and mirror setup
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / linter-shell (push) Has been cancelled
Mark stable commit / linter-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
Some checks failed
Mark stable commit / test-unit (push) Has been cancelled
Mark stable commit / test-integration (push) Has been cancelled
Mark stable commit / test-env-virtual (push) Has been cancelled
Mark stable commit / test-env-nix (push) Has been cancelled
Mark stable commit / test-e2e (push) Has been cancelled
Mark stable commit / test-virgin-user (push) Has been cancelled
Mark stable commit / test-virgin-root (push) Has been cancelled
Mark stable commit / linter-shell (push) Has been cancelled
Mark stable commit / linter-python (push) Has been cancelled
Mark stable commit / mark-stable (push) Has been cancelled
https://chatgpt.com/share/693f5bdb-1780-800f-a772-0ecf399627fc
This commit is contained in:
42
tests/e2e/test_repos_create_preview_output.py
Normal file
42
tests/e2e/test_repos_create_preview_output.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import unittest
|
||||
from contextlib import redirect_stdout
|
||||
from unittest.mock import patch
|
||||
|
||||
from pkgmgr.actions.repository.create import create_repo
|
||||
|
||||
|
||||
class TestE2ECreateRepoPreviewOutput(unittest.TestCase):
|
||||
def test_create_repo_preview_prints_expected_steps(self) -> None:
|
||||
cfg = {"directories": {"repositories": "/tmp/Repositories"}, "repositories": []}
|
||||
|
||||
out = io.StringIO()
|
||||
with (
|
||||
redirect_stdout(out),
|
||||
patch("pkgmgr.actions.repository.create.os.path.exists", return_value=False),
|
||||
patch("pkgmgr.actions.repository.create.generate_alias", return_value="repo"),
|
||||
patch("pkgmgr.actions.repository.create.save_user_config"),
|
||||
patch("pkgmgr.actions.repository.create.os.makedirs"),
|
||||
patch("pkgmgr.actions.repository.create.render_default_templates"),
|
||||
patch("pkgmgr.actions.repository.create.write_mirrors_file"),
|
||||
patch("pkgmgr.actions.repository.create.setup_mirrors"),
|
||||
patch("pkgmgr.actions.repository.create.subprocess.run"),
|
||||
):
|
||||
create_repo(
|
||||
"github.com/acme/repo",
|
||||
cfg,
|
||||
"/tmp/user.yml",
|
||||
"/tmp/bin",
|
||||
remote=False,
|
||||
preview=True,
|
||||
)
|
||||
|
||||
s = out.getvalue()
|
||||
self.assertIn("[Preview] Would save user config:", s)
|
||||
self.assertIn("[Preview] Would ensure directory exists:", s)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user