From 401d8309420839981a0b81452adf998b91d9e62d Mon Sep 17 00:00:00 2001 From: Nathaniel Landau Date: Sun, 5 Feb 2023 10:28:53 -0500 Subject: [PATCH] fix: remove unnecessary question when viewing diffs --- src/obsidian_metadata/models/application.py | 10 ++-------- tests/application_test.py | 6 +----- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/obsidian_metadata/models/application.py b/src/obsidian_metadata/models/application.py index 3201273..61f9018 100644 --- a/src/obsidian_metadata/models/application.py +++ b/src/obsidian_metadata/models/application.py @@ -517,13 +517,7 @@ class Application: alerts.info("No changes to review.") return - print(f"\nFound {len(changed_notes)} changed notes in the vault.\n") - answer = self.questions.ask_confirm( - question="View diffs of individual files?", default=False - ) - if not answer: # pragma: no cover - return - + alerts.info(f"Found {len(changed_notes)} changed notes in the vault") choices: list[dict[str, Any] | questionary.Separator] = [questionary.Separator()] for n, note in enumerate(changed_notes, start=1): _selection = { @@ -538,7 +532,7 @@ class Application: while True: note_to_review = self.questions.ask_selection( choices=choices, - question="Select a new to view the diff", + question="Select an updated note to view the diff", ) if note_to_review is None or note_to_review == "return": break diff --git a/tests/application_test.py b/tests/application_test.py index 0de04c5..a09507d 100644 --- a/tests/application_test.py +++ b/tests/application_test.py @@ -530,10 +530,6 @@ def test_review_changes(test_application, mocker, capsys) -> None: "obsidian_metadata.models.application.Questions.ask_application_main", side_effect=["rename_metadata", "review_changes", KeyError], ) - mocker.patch( - "obsidian_metadata.models.application.Questions.ask_confirm", - return_value=True, - ) mocker.patch( "obsidian_metadata.models.application.Questions.ask_existing_key", return_value="tags", @@ -549,7 +545,7 @@ def test_review_changes(test_application, mocker, capsys) -> None: with pytest.raises(KeyError): app.application_main() captured = capsys.readouterr() - assert captured.out == Regex(r".*Found.*\d+.*changed notes in the vault.*", re.DOTALL) + assert captured.out == Regex(r".*Found.*\d+.*changed notes in the vault", re.DOTALL) assert "- tags:" in captured.out assert "+ new_tags:" in captured.out