Skip to content

Commit

Permalink
Add test for Python API
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Jan 10, 2024
1 parent 8b707db commit 679e01a
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/pipeline/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typer.testing import CliRunner

import kpops
from kpops.cli.main import app
from kpops.cli.main import FilterType, app
from kpops.pipeline import ParsingException, ValidationError

runner = CliRunner()
Expand All @@ -23,6 +23,33 @@ def test_python_api(self):
output=False,
)
assert len(pipeline) == 3
assert [component.type for component in pipeline.root] == [
"scheduled-producer",
"converter",
"filter",
]

def test_python_api_filter_include(self):
pipeline = kpops.generate(
RESOURCE_PATH / "first-pipeline" / "pipeline.yaml",
defaults=RESOURCE_PATH,
output=False,
steps="converter",
filter_type=FilterType.INCLUDE,
)
assert len(pipeline) == 1
assert pipeline.root[0].type == "converter"

def test_python_api_filter_exclude(self):
pipeline = kpops.generate(
RESOURCE_PATH / "first-pipeline" / "pipeline.yaml",
defaults=RESOURCE_PATH,
output=False,
steps="converter,scheduled-producer",
filter_type=FilterType.EXCLUDE,
)
assert len(pipeline) == 1
assert pipeline.root[0].type == "filter"

def test_load_pipeline(self, snapshot: SnapshotTest):
result = runner.invoke(
Expand Down

0 comments on commit 679e01a

Please sign in to comment.