first usable curator UI
This commit is contained in:
parent
8f94c38309
commit
aa18dfc8f2
10 changed files with 677 additions and 10 deletions
43
tests/test_repository_metadata.py
Normal file
43
tests/test_repository_metadata.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
from repo_registry.repo_ingestion.metadata import RepositoryMetadataExtractor
|
||||
|
||||
|
||||
def test_metadata_prefers_pyproject(tmp_path):
|
||||
repo = tmp_path / "repo"
|
||||
repo.mkdir()
|
||||
(repo / "pyproject.toml").write_text(
|
||||
'[project]\nname = "invoice-tools"\ndescription = "Extract invoice data."\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
metadata = RepositoryMetadataExtractor().extract(repo, str(repo))
|
||||
|
||||
assert metadata.name == "invoice-tools"
|
||||
assert metadata.description == "Extract invoice data."
|
||||
|
||||
|
||||
def test_metadata_uses_package_json(tmp_path):
|
||||
repo = tmp_path / "repo"
|
||||
repo.mkdir()
|
||||
(repo / "package.json").write_text(
|
||||
'{"name":"frontend-registry","description":"Browse repository abilities."}',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
metadata = RepositoryMetadataExtractor().extract(repo, str(repo))
|
||||
|
||||
assert metadata.name == "frontend-registry"
|
||||
assert metadata.description == "Browse repository abilities."
|
||||
|
||||
|
||||
def test_metadata_falls_back_to_readme_title(tmp_path):
|
||||
repo = tmp_path / "repo-name"
|
||||
repo.mkdir()
|
||||
(repo / "README.md").write_text(
|
||||
"# Useful Registry\n\nExtra details follow.\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
metadata = RepositoryMetadataExtractor().extract(repo, str(repo))
|
||||
|
||||
assert metadata.name == "Useful Registry"
|
||||
assert metadata.description == "Extra details follow."
|
||||
Loading…
Add table
Add a link
Reference in a new issue