File: test_lint.py

package info (click to toggle)
stactools 0.5.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,796 kB
  • sloc: python: 4,498; xml: 554; sh: 395; makefile: 34
file content (33 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pytest
from click.testing import CliRunner
from stactools.cli.cli import cli

from tests import test_data

pytest.importorskip("stac_check")


def test_valid_item() -> None:
    path = test_data.get_path("data-files/linting/20201211_223832_cs2.json")

    runner = CliRunner()
    result = runner.invoke(cli, ["lint", path])
    assert result.exit_code == 0


def test_invalid_item() -> None:
    path = test_data.get_path("data-files/linting/core-item.json")

    runner = CliRunner()
    result = runner.invoke(cli, ["lint", path])
    assert result.exit_code == 1


def test_collection_with_invalid_name() -> None:
    path = test_data.get_path(
        "data-files/basic/country-1/area-1-1/collection-invalid.json"
    )

    runner = CliRunner()
    result = runner.invoke(cli, ["lint", path])
    assert result.exit_code == 1