diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-03-24 23:10:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-03-24 23:10:43 +0000 |
commit | 4bbf6c088551d74da917b0ad9c1e83366afa9a50 (patch) | |
tree | e50dbe6b1d31c17ef7129d50c6bc5480c5539690 /tests/cli_test.py | |
parent | Initial commit. (diff) | |
download | identify-4bbf6c088551d74da917b0ad9c1e83366afa9a50.tar.xz identify-4bbf6c088551d74da917b0ad9c1e83366afa9a50.zip |
Adding upstream version 1.4.13.upstream/1.4.13
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/cli_test.py')
-rw-r--r-- | tests/cli_test.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/cli_test.py b/tests/cli_test.py new file mode 100644 index 0000000..9369a5e --- /dev/null +++ b/tests/cli_test.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import +from __future__ import unicode_literals + +from identify import cli + + +def test_identify_cli(capsys): + ret = cli.main(('setup.py',)) + out, _ = capsys.readouterr() + assert ret == 0 + assert out == '["file", "non-executable", "python", "text"]\n' + + +def test_identify_cli_filename_only(capsys): + ret = cli.main(('setup.py', '--filename-only')) + out, _ = capsys.readouterr() + assert ret == 0 + assert out == '["python", "text"]\n' + + +def test_identify_cli_filename_only_unidentified(capsys): + ret = cli.main(('x.unknown', '--filename-only')) + out, _ = capsys.readouterr() + assert ret == 1 + assert out == '' + + +def test_file_not_found(capsys): + ret = cli.main(('x.unknown',)) + out, _ = capsys.readouterr() + assert ret == 1 + assert out == 'x.unknown does not exist.\n' |