mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 06:51:00 +02:00
Squashed 'ai-context/trustgraph-templates/' content from commit 42a5fd1b
git-subtree-dir: ai-context/trustgraph-templates git-subtree-split: 42a5fd1b678f32be378062e30451e2052ccb95dd
This commit is contained in:
commit
74cc8a4685
1216 changed files with 116347 additions and 0 deletions
60
tests/unit/test_packager.py
Normal file
60
tests/unit/test_packager.py
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
"""
|
||||
Unit tests for Packager class.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from trustgraph_configurator.packager import Packager
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
class TestPackager:
|
||||
"""Tests for the Packager class."""
|
||||
|
||||
def test_init_with_latest_stable(self):
|
||||
"""Test initialization with latest_stable flag."""
|
||||
packager = Packager(
|
||||
version=None,
|
||||
template=None,
|
||||
platform="docker-compose",
|
||||
latest=False,
|
||||
latest_stable=True
|
||||
)
|
||||
assert packager.version is not None
|
||||
assert packager.template is not None
|
||||
|
||||
def test_init_with_template(self):
|
||||
"""Test initialization with specific template."""
|
||||
packager = Packager(
|
||||
version="1.8.12",
|
||||
template="1.8",
|
||||
platform="docker-compose",
|
||||
latest=False,
|
||||
latest_stable=False
|
||||
)
|
||||
assert packager.version == "1.8.12"
|
||||
assert packager.template == "1.8"
|
||||
assert packager.platform == "docker-compose"
|
||||
|
||||
def test_invalid_platform_raises_error(self):
|
||||
"""Test that invalid platform raises error during generation."""
|
||||
packager = Packager(
|
||||
version="1.8.12",
|
||||
template="1.8",
|
||||
platform="invalid-platform",
|
||||
latest=False,
|
||||
latest_stable=False
|
||||
)
|
||||
|
||||
with pytest.raises(RuntimeError, match="Bad platform"):
|
||||
packager.generate('[{"name": "test", "parameters": {}}]')
|
||||
|
||||
def test_init_without_template_raises_error(self):
|
||||
"""Test that initialization without template/latest raises error."""
|
||||
with pytest.raises(RuntimeError, match="You must"):
|
||||
Packager(
|
||||
version=None,
|
||||
template=None,
|
||||
platform="docker-compose",
|
||||
latest=False,
|
||||
latest_stable=False
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue