コード例 #1
0
ファイル: test_cli.py プロジェクト: dcubasoy/psnprices
def test_cli_search():
    sys.argv = ["eshopcli", "--query", "'Vostok'"]

    with pytest.raises(SystemExit) as pytest_wrapped_e:
        eshop_main()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
コード例 #2
0
ファイル: test_cli.py プロジェクト: dcubasoy/psnprices
def test_cli_by_id_and_whish_price_matched():
    sys.argv = [
        "eshopcli", "--id", "DE/de###1173281###Mario_Kart_8_Deluxe", "--price",
        "100"
    ]

    with pytest.raises(SystemExit) as pytest_wrapped_e:
        eshop_main()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
コード例 #3
0
def test_cli_search():
    sys.argv = [
        "eshopcli",
        "--query",
        "'Vostok'"
    ]

    with pytest.raises(SystemExit) as pytest_wrapped_e:
        eshop_main()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
コード例 #4
0
def test_cli_by_id_and_whish_price_matched():
    sys.argv = [
        "eshopcli",
        "--id",
        "DE/de###1173281###Mario_Kart_8_Deluxe",
        "--price",
        "100"
    ]

    with pytest.raises(SystemExit) as pytest_wrapped_e:
        eshop_main()
    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0
コード例 #5
0
def test_eshop_cli_json(capsys):
    sys.argv = ["eshopcli", "--json", "--query", "Tetris"]

    with pytest.raises(SystemExit) as pytest_wrapped_e:
        eshop_main()

    captured = capsys.readouterr()
    response = json.loads(captured.out)
    assert response is not None

    # Check if response json is populated
    assert len(response[0]["name"]) > 0
    assert len(response[0]["prices"]) > 0
    assert len(response[0]["type"]) > 0

    assert pytest_wrapped_e.type == SystemExit
    assert pytest_wrapped_e.value.code == 0