| 460 | |
| 461 | |
| 462 | def test_scripts_add_to_history(base_app, request) -> None: |
| 463 | test_dir = os.path.dirname(request.module.__file__) |
| 464 | filename = os.path.join(test_dir, "scripts", "help.txt") |
| 465 | command = f"run_script {filename}" |
| 466 | |
| 467 | # Add to history |
| 468 | base_app.scripts_add_to_history = True |
| 469 | base_app.history.clear() |
| 470 | run_cmd(base_app, command) |
| 471 | assert len(base_app.history) == 2 |
| 472 | assert base_app.history.get(1).raw == command |
| 473 | assert base_app.history.get(2).raw == "help -v" |
| 474 | |
| 475 | # Do not add to history |
| 476 | base_app.scripts_add_to_history = False |
| 477 | base_app.history.clear() |
| 478 | run_cmd(base_app, command) |
| 479 | assert len(base_app.history) == 1 |
| 480 | assert base_app.history.get(1).raw == command |
| 481 | |
| 482 | |
| 483 | def test_run_script_nested_run_scripts(base_app, request) -> None: |