Skip to content

Commit

Permalink
test(registry): Test sync
Browse files Browse the repository at this point in the history
  • Loading branch information
topher-lo committed Dec 8, 2024
1 parent c0cbe75 commit 771d025
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# UV
uv.lock

# Terraform-related files
*.tfstate
*.tfstate.backup
Expand Down
16 changes: 15 additions & 1 deletion tests/registry/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
import yaml

from tracecat.registry.actions.models import TemplateAction
from tracecat.registry.repository import Repository


@pytest.fixture(scope="module")
def registry():
registry = Repository()
registry.init(include_base=False, include_templates=True)
return registry


@pytest.mark.anyio
Expand All @@ -12,9 +20,15 @@
list(Path("registry/tracecat_registry/templates").rglob("*.yml")),
ids=lambda path: str(path.parts[-2:]),
)
async def test_template_action_validation(file_path):
async def test_template_action_validation(file_path, registry):
with open(file_path) as file:
template = yaml.safe_load(file)

# Test parsing
action = TemplateAction(**template)
assert action.type == "action"
assert action.definition

# Test registration
registry.register_template_action(action)
assert action.definition.action in registry

0 comments on commit 771d025

Please sign in to comment.