-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Meret Behrens <meret.behrens@tngtech.com>
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
from typing import Tuple | ||
|
||
import pytest | ||
from click.testing import CliRunner | ||
|
||
from spdx.clitools.pyspdxtools import main | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"options", | ||
[ | ||
("--infile", os.path.join(os.path.dirname(__file__), "data/SPDXJSONExample-v2.3.spdx.json")), | ||
("-i", os.path.join(os.path.dirname(__file__), "data/SPDXJSONExample-v2.3.spdx.json"), "--novalidation"), | ||
( | ||
"-i", | ||
os.path.join(os.path.dirname(__file__), "data/SPDXJSONExample-v2.3.spdx.json"), | ||
"--novalidation", | ||
"--version", | ||
"SPDX-2.3", | ||
), | ||
("-i", os.path.join(os.path.dirname(__file__), "data/SPDXJSONExample-v2.3.spdx.json"), "-o", "-"), | ||
], | ||
) | ||
def test_cli(options: Tuple[str, str]): | ||
runner = CliRunner() | ||
|
||
result = runner.invoke(main, options) | ||
|
||
assert result.exit_code == 0 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"options", | ||
[ | ||
(), | ||
("-i", os.path.join(os.path.dirname(__file__), "data/SPDXJSONExample-v2.3.spdx.json"), "--version"), | ||
("-i", os.path.join(os.path.dirname(__file__), "data/SPDXJSONExample-v2.3.spdx.json"), "-o"), | ||
], | ||
) | ||
def test_cli_with_system_exit(options): | ||
runner = CliRunner() | ||
|
||
result = runner.invoke(main, options) | ||
|
||
assert result.exit_code == 2 |