| 1 | + | from argparse import ArgumentTypeError |
| 2 | + | |
| 3 | + | import pytest |
| 4 | + | |
| 5 | + | from rtspbrute.modules.cli.input import file_path, port |
| 6 | + | |
| 7 | + | |
| 8 | + | def test_file_path(tmp_path): |
| 9 | + | assert file_path(tmp_path) == tmp_path |
| 10 | + | with pytest.raises(ArgumentTypeError) as excinfo: |
| 11 | + | non_existing_path = tmp_path / "file.txt" |
| 12 | + | file_path(non_existing_path) |
| 13 | + | assert str(non_existing_path) in str(excinfo.value) |
| 14 | + | |
| 15 | + | |
| 16 | + | def test_port(): |
| 17 | + | assert port("554") == 554 |
| 18 | + | with pytest.raises(ArgumentTypeError) as excinfo: |
| 19 | + | bad_port = 65536 |
| 20 | + | port(bad_port) |
| 21 | + | assert str(bad_port) in str(excinfo.value) |
| 22 | + | |