Skip to content

Commit

Permalink
Added test for pipelines resolution from directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspatzke committed Jul 13, 2024
1 parent 397abe1 commit 157858c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/files/pipelines/pipeline-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Test 1
priority: 10
transformations:
- id: test-1
type: field_name_suffix
suffix: .test
6 changes: 6 additions & 0 deletions tests/files/pipelines/pipeline-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Test 2
priority: 10
transformations:
- id: test-2
type: field_name_prefix
prefix: test.
20 changes: 19 additions & 1 deletion tests/test_processing_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
)
from sigma.processing.resolver import ProcessingPipelineResolver
from sigma.processing.pipeline import ProcessingPipeline, ProcessingItem
from sigma.processing.transformations import AddFieldnameSuffixTransformation
from sigma.processing.transformations import (
AddFieldnamePrefixTransformation,
AddFieldnameSuffixTransformation,
)
from collections.abc import Iterable


Expand Down Expand Up @@ -58,6 +61,21 @@ def test_resolve_file(processing_pipeline_resolver: ProcessingPipelineResolver):
)


def test_resolve_directory(processing_pipeline_resolver):
assert processing_pipeline_resolver.resolve(["tests/files/pipelines"]) == ProcessingPipeline(
items=[
ProcessingItem(
AddFieldnameSuffixTransformation(".test"),
identifier="test-1",
),
ProcessingItem(
AddFieldnamePrefixTransformation("test."),
identifier="test-2",
),
],
)


def test_resolve_callable():
pipeline = ProcessingPipeline(
[ProcessingItem(AddFieldnameSuffixTransformation(".item-1"))],
Expand Down

0 comments on commit 157858c

Please sign in to comment.