Skip to content

Commit

Permalink
Finnished the uint test for Confirm_user_backup()
Browse files Browse the repository at this point in the history
* This unit test was mostly done we just needed to account for the
  user input and now it does that and it passes
  • Loading branch information
Andrew-ang9 committed Jun 28, 2024
1 parent 0e2f8f1 commit c2f1e8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion convert2rhel/unit_tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,14 +810,18 @@ def test_handle_inhibitors_found_exception(monkeypatch, rollback_failures, retur
assert ret == return_code


def test_confirm_user_backup(caplog):
@pytest.mark.parametrize("user_input", ["y", "n"])
def test_confirm_user_backup(caplog, monkeypatch, user_input):
message = (
"Convert2RHEL modifies the systems during the analysis and then rolls back these "
"changes when the analysis is complete. In rare cases, this rollback can fail. "
"By continuing, you confirm that you have made a system backup and verified that "
"you can restore from the backup."
)

# Simulate user input
monkeypatch.setattr("builtins.input", lambda _: user_input)

main.confirm_user_backup()

assert message in caplog.text

0 comments on commit c2f1e8a

Please sign in to comment.