(monkeypatch, console)
| 2 | |
| 3 | |
| 4 | def test_spawn_editor(monkeypatch, console): |
| 5 | text_data = "text" |
| 6 | binary_data = b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" |
| 7 | |
| 8 | console.get_editor = Mock() |
| 9 | console.get_editor.return_value = "editor" |
| 10 | console.get_hex_editor = Mock() |
| 11 | console.get_hex_editor.return_value = "editor" |
| 12 | monkeypatch.setattr("subprocess.call", (lambda _: None)) |
| 13 | |
| 14 | console.loop = Mock() |
| 15 | console.loop.stop = Mock() |
| 16 | console.loop.start = Mock() |
| 17 | console.loop.draw_screen = Mock() |
| 18 | |
| 19 | console.spawn_editor(text_data) |
| 20 | console.get_editor.assert_called_once() |
| 21 | |
| 22 | console.spawn_editor(binary_data) |
| 23 | console.get_hex_editor.assert_called_once() |
| 24 | |
| 25 | |
| 26 | def test_get_hex_editor(monkeypatch, console): |
nothing calls this directly
no test coverage detected
searching dependent graphs…