diff --git a/repo_autoindex/_impl/base.py b/repo_autoindex/_impl/base.py
index 4362007..213db3c 100644
--- a/repo_autoindex/_impl/base.py
+++ b/repo_autoindex/_impl/base.py
@@ -26,13 +26,6 @@ class IndexEntry:
padding: str = ""
icon: str = ICON_OTHER
- @property
- def href_leading_dir(self) -> str:
- components = self.href.split("/", 1)
- if len(components) == 1:
- return ""
- return components[0]
-
class Repo(ABC):
def __init__(
@@ -49,7 +42,7 @@ class Repo(ABC):
def render_index(
self, index_href_suffix: str
) -> AsyncGenerator[GeneratedIndex, None]:
- pass
+ pass # pragma: no cover
@classmethod
@abstractmethod
@@ -58,4 +51,4 @@ class Repo(ABC):
If so, returns an initialized Repo of a concrete subtype. If not, returns None.
"""
- pass
+ pass # pragma: no cover
diff --git a/repo_autoindex/templates/index.html.j2 b/repo_autoindex/_impl/templates/index.html.j2
similarity index 100%
rename from repo_autoindex/templates/index.html.j2
rename to repo_autoindex/_impl/templates/index.html.j2
diff --git a/tests/test_yum_render_typical.py b/tests/test_yum_render_typical.py
new file mode 100644
index 0000000..d12dd4e
--- /dev/null
+++ b/tests/test_yum_render_typical.py
@@ -0,0 +1,450 @@
+from typing import Optional
+import textwrap
+import pytest
+
+from repo_autoindex import autoindex
+from repo_autoindex._impl.base import GeneratedIndex
+
+REPOMD_XML = textwrap.dedent(
+ """
+
+
+ 1657165688
+
+ d4888f04f95ac067af4d997d35c6d345cbe398563d777d017a3634c9ed6148cf
+ 6fc4eddd4e9de89246efba3815b8a9dec9dfe168e4fd3104cc792dff908a0f62
+
+ 1657165688
+ 2932
+ 16585
+
+
+ 284769ec79daa9e0a3b0129bb6260cc6271c90c4fe02b43dfa7cdf7635fb803f
+ 72f89223c8b0f6c7a2ee6ed7fbd16ee0bb395ca68260038bb3895265af84c29f
+
+ 1657165688
+ 4621
+ 36911
+
+
+ 36c2195bbee0c39ee080969abc6fd59d943c3471114cfd43c6e776ac20d7ed21
+ 39f52cf295db14e863abcd7b2eede8e6c5e39ac9b2f194349459d29cd492c90f
+
+ 1657165688
+ 1408
+ 8432
+
+
+ 55e6bfd00e889c5c1f9a3c9fb35a660158bc5d975ae082d434f3cf81cc2c0c21
+ b2692c49d1d98d68e764e29108d8a81a3dfd9e04fa7665115853a029396d118d
+
+ 1657165688
+ 7609
+ 114688
+ 10
+
+
+ de63a509812c37f7736fcef0b79e9c55dfe67a2d77006f74fdc442935103e9e6
+ 40eb5d53fe547c98d470813256c9bfc8a239b13697d8eb824a1485c9e186a0e3
+
+ 1657165688
+ 10323
+ 65536
+ 10
+
+
+ 9aa39b62df200cb3784dea24092d0c1c686afff0cd0990c2ec7a61afe8896e1c
+ 3e5cefb10ce805b827e12ca3b4839bba873dc9403fd92b60a364bf6f312bd972
+
+ 1657165688
+ 2758
+ 32768
+ 10
+
+
+"""
+).strip()
+
+PRIMARY_XML = textwrap.dedent(
+ """
+
+
+
+ wireplumber
+ x86_64
+
+ 539a773f3f39a7b2b5f971bdd0063f7d4201aab00920f380962e935356dc4d3a
+ A modular session/policy manager for PipeWire
+ WirePlumber is a modular session/policy manager for PipeWire and a
+GObject-based high-level library that wraps PipeWire's API, providing
+convenience for writing the daemon's modules as well as external tools for
+managing PipeWire.
+ Fedora Project
+ https://pipewire.pages.freedesktop.org/wireplumber/
+
+
+
+
+ MIT
+ Fedora Project
+ Unspecified
+ buildvm-x86-27.iad2.fedoraproject.org
+ wireplumber-0.4.10-1.fc36.src.rpm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /etc/wireplumber
+ /etc/wireplumber/bluetooth.lua.d
+ /etc/wireplumber/common
+ /etc/wireplumber/main.lua.d
+ /etc/wireplumber/policy.lua.d
+ /usr/bin/wireplumber
+ /usr/bin/wpctl
+ /usr/bin/wpexec
+
+
+
+ wireplumber-libs
+ x86_64
+
+ 1f0d373bd1b8af6b4b7baab1c89e4820aa8cd8691f51fca4fccac9785fe715ea
+ Libraries for WirePlumber clients
+ This package contains the runtime libraries for any application that wishes
+to interface with WirePlumber.
+ Fedora Project
+ https://pipewire.pages.freedesktop.org/wireplumber/
+
+
+
+
+ MIT
+ Fedora Project
+ Unspecified
+ buildvm-x86-27.iad2.fedoraproject.org
+ wireplumber-0.4.10-1.fc36.src.rpm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xfce4-panel
+ x86_64
+
+ 1eecad127499d557f9d97562a1c65d9c881f3f63431546007a9ed714997b909c
+ Next generation panel for Xfce
+ This package includes the panel for the Xfce desktop environment.
+ Fedora Project
+ http://www.xfce.org/
+
+
+
+
+ GPLv2+ and LGPLv2+
+ Fedora Project
+ Unspecified
+ buildvm-x86-16.iad2.fedoraproject.org
+ xfce4-panel-4.16.4-1.fc36.src.rpm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /etc/xdg/xfce4/panel/default.xml
+ /usr/bin/xfce4-panel
+ /usr/bin/xfce4-popup-applicationsmenu
+ /usr/bin/xfce4-popup-directorymenu
+ /usr/bin/xfce4-popup-windowmenu
+
+
+
+ xfce4-power-manager
+ x86_64
+
+ 48697b6e83646e702d83523acd4a25df546129a1a11f3fbb81724c30d58e9c21
+ Power management for the Xfce desktop environment
+ Xfce Power Manager uses the information and facilities provided by HAL to
+display icons and handle user callbacks in an interactive Xfce session.
+Xfce Power Preferences allows authorised users to set policy and change
+preferences.
+ Fedora Project
+ http://goodies.xfce.org/projects/applications/xfce4-power-manager
+
+
+
+
+ GPLv2+
+ Fedora Project
+ Unspecified
+ buildvm-x86-21.iad2.fedoraproject.org
+ xfce4-power-manager-4.16.0-5.fc36.src.rpm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /etc/xdg/autostart/xfce4-power-manager.desktop
+ /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
+ /usr/bin/xfce4-power-manager
+ /usr/bin/xfce4-power-manager-settings
+ /usr/sbin/xfce4-pm-helper
+ /usr/sbin/xfpm-power-backlight-helper
+
+
+
+ xfce4-terminal
+ x86_64
+
+ 6b6d0d941c16988b4c68ae473f1af141dedafe691922c0c88f6f3ef82baeef79
+ Terminal Emulator for the Xfce Desktop environment
+ Xfce4-terminal is a lightweight and easy to use terminal emulator application
+with many advanced features including drop down, tabs, unlimited scrolling,
+full colors, fonts, transparent backgrounds, and more.
+ Fedora Project
+ http://docs.xfce.org/apps/terminal/start
+
+
+
+
+ GPLv2+
+ Fedora Project
+ Unspecified
+ buildvm-x86-15.iad2.fedoraproject.org
+ xfce4-terminal-1.0.3-1.fc36.src.rpm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /usr/bin/xfce4-terminal
+
+
+
+"""
+).strip()
+
+
+class StaticFetcher:
+ def __init__(self):
+ self.content: dict[str, str] = {}
+
+ async def __call__(self, url: str) -> Optional[str]:
+ return self.content[url]
+
+
+async def test_typical_index():
+ fetcher = StaticFetcher()
+
+ fetcher.content["https://example.com/repodata/repomd.xml"] = REPOMD_XML
+ fetcher.content[
+ "https://example.com/repodata/d4888f04f95ac067af4d997d35c6d345cbe398563d777d017a3634c9ed6148cf-primary.xml.gz"
+ ] = PRIMARY_XML
+
+ entries: list[GeneratedIndex] = []
+ async for entry in autoindex("https://example.com", fetcher=fetcher):
+ entries.append(entry)
+
+ # It should generate some entries
+ assert entries
+
+ entries.sort(key=lambda e: e.relative_dir)
+
+ # First check that the directory structure was reproduced.
+ assert [e.relative_dir for e in entries] == [
+ "",
+ "packages",
+ "packages/w",
+ "packages/x",
+ "repodata",
+ ]
+
+ by_relative_dir: dict[str, GeneratedIndex] = {}
+ for entry in entries:
+ by_relative_dir[entry.relative_dir] = entry
+
+ # Sanity check a few links expected to appear in each.
+ assert '' in by_relative_dir[""].content
+ assert '' in by_relative_dir[""].content
+
+ assert '' in by_relative_dir["packages"].content
+ assert '' in by_relative_dir["packages"].content
+
+ assert (
+ ''
+ in by_relative_dir["repodata"].content
+ )
+
+ assert (
+ ''
+ in by_relative_dir["packages/w"].content
+ )
+ assert (
+ ''
+ in by_relative_dir["packages/x"].content
+ )