| 1 |
import importlib.util |
| 2 |
from pathlib import Path |
| 3 |
from unittest.mock import Mock |
| 4 |
|
| 5 |
import pytest |
| 6 |
|
| 7 |
|
| 8 |
COMMAND_PATH = ( |
| 9 |
Path(__file__).resolve().parents[2] |
| 10 |
/ "fenrirscreenreader" |
| 11 |
/ "commands" |
| 12 |
/ "commands" |
| 13 |
/ "toggle_vmenu_mode.py" |
| 14 |
) |
| 15 |
|
| 16 |
|
| 17 |
def load_command(): |
| 18 |
spec = importlib.util.spec_from_file_location( |
| 19 |
"fenrir_toggle_vmenu_mode", COMMAND_PATH |
| 20 |
) |
| 21 |
module = importlib.util.module_from_spec(spec) |
| 22 |
spec.loader.exec_module(module) |
| 23 |
return module.command() |
| 24 |
|
| 25 |
|
| 26 |
@pytest.mark.unit |
| 27 |
def test_get_description_does_not_toggle_vmenu_mode(): |
| 28 |
vmenu_manager = Mock() |
| 29 |
command = load_command() |
| 30 |
command.initialize({"runtime": {"VmenuManager": vmenu_manager}}) |
| 31 |
|
| 32 |
assert command.get_description() == "Entering or Leaving v menu mode." |
| 33 |
vmenu_manager.toggle_vmenu_mode.assert_not_called() |