Test getting specific extension info.
(self, temp_dir)
| 3192 | assert results[0]["id"] == "jira" |
| 3193 | |
| 3194 | def test_get_extension_info(self, temp_dir): |
| 3195 | """Test getting specific extension info.""" |
| 3196 | import yaml as yaml_module |
| 3197 | |
| 3198 | project_dir = temp_dir / "project" |
| 3199 | project_dir.mkdir() |
| 3200 | (project_dir / ".specify").mkdir() |
| 3201 | |
| 3202 | # Use a single-catalog config so community extensions don't interfere |
| 3203 | config_path = project_dir / ".specify" / "extension-catalogs.yml" |
| 3204 | with open(config_path, "w") as f: |
| 3205 | yaml_module.dump( |
| 3206 | { |
| 3207 | "catalogs": [ |
| 3208 | { |
| 3209 | "name": "test-catalog", |
| 3210 | "url": ExtensionCatalog.DEFAULT_CATALOG_URL, |
| 3211 | "priority": 1, |
| 3212 | "install_allowed": True, |
| 3213 | } |
| 3214 | ] |
| 3215 | }, |
| 3216 | f, |
| 3217 | ) |
| 3218 | |
| 3219 | catalog = ExtensionCatalog(project_dir) |
| 3220 | |
| 3221 | # Create mock catalog |
| 3222 | catalog_data = { |
| 3223 | "schema_version": "1.0", |
| 3224 | "extensions": { |
| 3225 | "jira": { |
| 3226 | "name": "Jira Integration", |
| 3227 | "id": "jira", |
| 3228 | "version": "1.0.0", |
| 3229 | "description": "Jira integration", |
| 3230 | "author": "Stats Perform", |
| 3231 | }, |
| 3232 | }, |
| 3233 | } |
| 3234 | |
| 3235 | catalog.cache_dir.mkdir(parents=True, exist_ok=True) |
| 3236 | catalog.cache_file.write_text(json.dumps(catalog_data)) |
| 3237 | catalog.cache_metadata_file.write_text( |
| 3238 | json.dumps( |
| 3239 | { |
| 3240 | "cached_at": datetime.now(timezone.utc).isoformat(), |
| 3241 | "catalog_url": "http://test.com", |
| 3242 | } |
| 3243 | ) |
| 3244 | ) |
| 3245 | |
| 3246 | # Get extension info |
| 3247 | info = catalog.get_extension_info("jira") |
| 3248 | assert info is not None |
| 3249 | assert info["id"] == "jira" |
| 3250 | assert info["name"] == "Jira Integration" |
| 3251 |
nothing calls this directly
no test coverage detected