|
8 | 8 |
|
9 | 9 | from portal_generator.utils import get_category, CATEGORY_MAPPING |
10 | 10 | from portal_generator.builders.tree_builder import build_operation_tree, count_tree_operations |
11 | | -from portal_generator.template_env import _nl2br, _nl2br_html, _render_markdown, _tojson_raw |
| 11 | +from portal_generator.template_env import _nl2br, _nl2br_html, _render_markdown, _tojson_raw, _skill_title |
12 | 12 | from portal_generator.generator import _build_api_meta, _get_example_body, PortalGenerator |
13 | 13 | from portal_generator.parsers.skill_parser import ( |
14 | 14 | _extract_yaml_blocks, |
@@ -227,6 +227,33 @@ def test_custom_indent(self): |
227 | 227 | assert ' "a"' in str(result) |
228 | 228 |
|
229 | 229 |
|
| 230 | +# ============================================================================ |
| 231 | +# _skill_title |
| 232 | +# ============================================================================ |
| 233 | + |
| 234 | +class TestSkillTitle: |
| 235 | + def test_api_uppercase(self): |
| 236 | + assert _skill_title('apply-policy-to-api-instance') == 'Apply Policy To API Instance' |
| 237 | + |
| 238 | + def test_mcp_uppercase(self): |
| 239 | + assert _skill_title('protect-mcp-server-with-policies') == 'Protect MCP Server With Policies' |
| 240 | + |
| 241 | + def test_multiple_acronyms(self): |
| 242 | + assert _skill_title('setup-api-with-oauth') == 'Setup API With Oauth' |
| 243 | + |
| 244 | + def test_no_acronyms(self): |
| 245 | + assert _skill_title('run-agent-scan-and-view-results') == 'Run Agent Scan And View Results' |
| 246 | + |
| 247 | + def test_empty_string(self): |
| 248 | + assert _skill_title('') == '' |
| 249 | + |
| 250 | + def test_single_word(self): |
| 251 | + assert _skill_title('api') == 'API' |
| 252 | + |
| 253 | + def test_already_spaced(self): |
| 254 | + assert _skill_title('protect api with policies') == 'Protect API With Policies' |
| 255 | + |
| 256 | + |
230 | 257 | # ============================================================================ |
231 | 258 | # generator helpers |
232 | 259 | # ============================================================================ |
|
0 commit comments