forked from MeltanoLabs/tap-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_discover.py
More file actions
34 lines (28 loc) · 906 Bytes
/
test_discover.py
File metadata and controls
34 lines (28 loc) · 906 Bytes
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
34
from __future__ import annotations
import json
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from pathlib import Path
@pytest.mark.noconfig
def test_catalog_changes(pytester: pytest.Pytester, tmp_path: Path) -> None:
"""Fail if the catalog has changed."""
# TODO: Discovery should be able to run any config
dummy_config = {
"repositories": [
"meltano/meltano",
"meltano/sdk",
],
}
config_path = tmp_path / "config.json"
config_path.write_text(json.dumps(dummy_config))
result = pytester.run(
"tap-github",
"--discover",
f"--config={config_path.as_posix()}",
)
assert result.ret == 0, "Tap discovery failed"
catalog = json.loads("".join(result.outlines))
assert "streams" in catalog
assert isinstance(catalog["streams"], list)
assert len(catalog["streams"]) > 0