34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
from uuid import uuid4
|
|
|
|
from app.discovery.criteria import parse_project_criteria
|
|
from app.discovery.enums import TaxonomyStatus
|
|
from app.settings import Settings
|
|
|
|
|
|
def test_parse_accepts_definition_id_and_enabled_flag():
|
|
definition_id = uuid4()
|
|
parsed = parse_project_criteria(
|
|
{
|
|
"items": [
|
|
{
|
|
"criterion_definition_id": str(definition_id),
|
|
"operator": ">=",
|
|
"value": 24,
|
|
"enabled_for_discovery": True,
|
|
}
|
|
]
|
|
}
|
|
)
|
|
assert parsed["items"][0]["criterion_definition_id"] == definition_id
|
|
assert parsed["items"][0]["enabled_for_discovery"] is True
|
|
|
|
|
|
def test_source_category_readiness_values():
|
|
assert TaxonomyStatus.NOT_LEARNED.value == "NOT_LEARNED"
|
|
assert TaxonomyStatus.READY.value == "READY"
|
|
|
|
|
|
def test_cors_origins_are_split_from_environment():
|
|
settings = Settings(cors_allowed_origins="http://localhost:4173, http://127.0.0.1:4173")
|
|
assert settings.cors_origins == ["http://localhost:4173", "http://127.0.0.1:4173"]
|