Test that expired cache is not used.
(self, temp_dir)
| 2897 | assert result == catalog_data |
| 2898 | |
| 2899 | def test_cache_expiration(self, temp_dir): |
| 2900 | """Test that expired cache is not used.""" |
| 2901 | project_dir = temp_dir / "project" |
| 2902 | project_dir.mkdir() |
| 2903 | (project_dir / ".specify").mkdir() |
| 2904 | |
| 2905 | catalog = ExtensionCatalog(project_dir) |
| 2906 | |
| 2907 | # Create expired cache |
| 2908 | catalog.cache_dir.mkdir(parents=True, exist_ok=True) |
| 2909 | catalog_data = {"schema_version": "1.0", "extensions": {}} |
| 2910 | catalog.cache_file.write_text(json.dumps(catalog_data)) |
| 2911 | |
| 2912 | # Set cache time to 2 hours ago (expired) |
| 2913 | expired_time = datetime.now(timezone.utc).timestamp() - 7200 |
| 2914 | expired_datetime = datetime.fromtimestamp(expired_time, tz=timezone.utc) |
| 2915 | catalog.cache_metadata_file.write_text( |
| 2916 | json.dumps( |
| 2917 | { |
| 2918 | "cached_at": expired_datetime.isoformat(), |
| 2919 | "catalog_url": "http://test.com/catalog.json", |
| 2920 | } |
| 2921 | ) |
| 2922 | ) |
| 2923 | |
| 2924 | # Cache should be invalid |
| 2925 | assert not catalog.is_cache_valid() |
| 2926 | |
| 2927 | def test_search_all_extensions(self, temp_dir): |
| 2928 | """Test searching all extensions without filters.""" |
nothing calls this directly
no test coverage detected