commit local changes.
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
"""Shared fixtures for the sjaur test suite."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from sjaur.metadata import Package
|
||||
from sjaur.search import SearchEngine
|
||||
|
||||
|
||||
def make_package(name: str, **extra) -> Package:
|
||||
"""Build a Package with sensible defaults; override anything via kwargs."""
|
||||
return Package(
|
||||
name=name,
|
||||
version=extra.get("version", "1.0.0-1"),
|
||||
description=extra.get("description", ""),
|
||||
maintainer=extra.get("maintainer", ""),
|
||||
votes=extra.get("votes", 0),
|
||||
popularity=extra.get("popularity", 0.0),
|
||||
out_of_date=extra.get("out_of_date"),
|
||||
last_modified=extra.get("last_modified", 0),
|
||||
first_submitted=extra.get("first_submitted", 0),
|
||||
url=extra.get("url", ""),
|
||||
url_path=extra.get("url_path", ""),
|
||||
package_base=extra.get("package_base", name),
|
||||
keywords=extra.get("keywords", ()),
|
||||
depends=extra.get("depends", ()),
|
||||
make_depends=extra.get("make_depends", ()),
|
||||
check_depends=extra.get("check_depends", ()),
|
||||
opt_depends=extra.get("opt_depends", ()),
|
||||
provides=extra.get("provides", ()),
|
||||
conflicts=extra.get("conflicts", ()),
|
||||
replaces=extra.get("replaces", ()),
|
||||
groups=extra.get("groups", ()),
|
||||
licenses=extra.get("licenses", ()),
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def engine() -> SearchEngine:
|
||||
"""A small, representative snapshot used by most search tests."""
|
||||
packages = [
|
||||
make_package(
|
||||
"firefox",
|
||||
version="130.0-1",
|
||||
description="Standalone web browser from mozilla.org",
|
||||
maintainer="jonas",
|
||||
votes=3500,
|
||||
keywords=("browser", "web"),
|
||||
),
|
||||
make_package(
|
||||
"firefox-nightly",
|
||||
description="Firefox Web Browser — nightly build",
|
||||
maintainer="john_doe",
|
||||
votes=120,
|
||||
),
|
||||
make_package(
|
||||
"firefox-wayland",
|
||||
description="Firefox with Wayland patches",
|
||||
maintainer="max_mustermann",
|
||||
votes=90,
|
||||
),
|
||||
make_package(
|
||||
"firefox-extension-uorigin",
|
||||
description="Firefox extension for managing redirect rules",
|
||||
maintainer="jane",
|
||||
votes=15,
|
||||
),
|
||||
make_package(
|
||||
"chromium",
|
||||
description="A web browser built from Chromium source",
|
||||
maintainer="jonas",
|
||||
votes=2800,
|
||||
provides=("chromium-browser",),
|
||||
),
|
||||
make_package(
|
||||
"python-pytest",
|
||||
description="Python testing tool with full-featured assertions",
|
||||
maintainer="max_musterman123",
|
||||
votes=950,
|
||||
depends=("python",),
|
||||
keywords=("testing", "python"),
|
||||
),
|
||||
make_package(
|
||||
"python-editor",
|
||||
description="Programmatically open an editor for python code",
|
||||
maintainer="orphan",
|
||||
votes=40,
|
||||
),
|
||||
make_package(
|
||||
"fzf",
|
||||
description="Command-line fuzzy finder",
|
||||
maintainer="alice",
|
||||
votes=2100,
|
||||
),
|
||||
make_package(
|
||||
"libreoffice-fresh",
|
||||
description="Office productivity suite",
|
||||
maintainer="",
|
||||
votes=1500,
|
||||
),
|
||||
]
|
||||
return SearchEngine(packages)
|
||||
Reference in New Issue
Block a user