Fix recipe listing, effects count, and add nav counts to all pages
- Fix list_by_type to return node_id (IPFS CID) instead of local hash - Fix effects count on home page (count from _effects/ directory) - Add nav_counts to all page templates (recipes, effects, runs, media, storage) - Add editable metadata section to cache/media detail page - Show more metadata on recipe detail page (ID, IPFS CID, step count) - Update tests for new list_by_type behavior Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,14 +20,14 @@ class TestRecipeListingFlow:
|
||||
assert 'def list_by_type' in content, \
|
||||
"L1CacheManager should have list_by_type method"
|
||||
|
||||
def test_list_by_type_returns_cid(self) -> None:
|
||||
"""list_by_type should return entry.cid values."""
|
||||
def test_list_by_type_returns_node_id(self) -> None:
|
||||
"""list_by_type should return entry.node_id values (IPFS CID)."""
|
||||
path = Path('/home/giles/art/art-celery/cache_manager.py')
|
||||
content = path.read_text()
|
||||
|
||||
# Find list_by_type function and verify it appends entry.cid
|
||||
assert 'hashes.append(entry.cid)' in content, \
|
||||
"list_by_type should append entry.cid to results"
|
||||
# Find list_by_type function and verify it appends entry.node_id
|
||||
assert 'cids.append(entry.node_id)' in content, \
|
||||
"list_by_type should append entry.node_id (IPFS CID) to results"
|
||||
|
||||
def test_recipe_service_uses_cache_list_by_type(self) -> None:
|
||||
"""Recipe service should use cache.list_by_type('recipe')."""
|
||||
@@ -110,3 +110,41 @@ class TestCacheEntryHasCid:
|
||||
source = inspect.getsource(Cache.put)
|
||||
assert 'cid=' in source, \
|
||||
"Cache.put should set cid on entry"
|
||||
|
||||
|
||||
class TestListByTypeReturnsEntries:
|
||||
"""Tests for list_by_type returning cached entries."""
|
||||
|
||||
def test_list_by_type_iterates_cache_entries(self) -> None:
|
||||
"""list_by_type should iterate self.cache.list_entries()."""
|
||||
path = Path('/home/giles/art/art-celery/cache_manager.py')
|
||||
content = path.read_text()
|
||||
|
||||
assert 'self.cache.list_entries()' in content, \
|
||||
"list_by_type should iterate cache entries"
|
||||
|
||||
def test_list_by_type_filters_by_node_type(self) -> None:
|
||||
"""list_by_type should filter entries by node_type."""
|
||||
path = Path('/home/giles/art/art-celery/cache_manager.py')
|
||||
content = path.read_text()
|
||||
|
||||
assert 'entry.node_type == node_type' in content, \
|
||||
"list_by_type should filter by node_type"
|
||||
|
||||
def test_list_by_type_returns_node_id(self) -> None:
|
||||
"""list_by_type should return entry.node_id (IPFS CID)."""
|
||||
path = Path('/home/giles/art/art-celery/cache_manager.py')
|
||||
content = path.read_text()
|
||||
|
||||
assert 'cids.append(entry.node_id)' in content, \
|
||||
"list_by_type should append entry.node_id (IPFS CID)"
|
||||
|
||||
def test_artdag_cache_list_entries_returns_all(self) -> None:
|
||||
"""artdag Cache.list_entries should return all entries."""
|
||||
from artdag import Cache
|
||||
import inspect
|
||||
|
||||
source = inspect.getsource(Cache.list_entries)
|
||||
# Should return self._entries.values()
|
||||
assert '_entries' in source, \
|
||||
"list_entries should access _entries dict"
|
||||
|
||||
Reference in New Issue
Block a user