mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
review changes
This commit is contained in:
parent
13c063c99d
commit
ccb6aaee39
@ -22,6 +22,7 @@ import logging
|
|||||||
from typing import Self
|
from typing import Self
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
|
from ahriman.core.status import Client
|
||||||
from ahriman.models.repository_id import RepositoryId
|
from ahriman.models.repository_id import RepositoryId
|
||||||
|
|
||||||
|
|
||||||
@ -49,8 +50,6 @@ class HttpLogHandler(logging.Handler):
|
|||||||
# we don't really care about those parameters because they will be handled by the reporter
|
# we don't really care about those parameters because they will be handled by the reporter
|
||||||
logging.Handler.__init__(self)
|
logging.Handler.__init__(self)
|
||||||
|
|
||||||
# client has to be imported here because of circular imports
|
|
||||||
from ahriman.core.status import Client
|
|
||||||
self.reporter = Client.load(repository_id, configuration, report=report)
|
self.reporter = Client.load(repository_id, configuration, report=report)
|
||||||
self.suppress_errors = suppress_errors
|
self.suppress_errors = suppress_errors
|
||||||
|
|
||||||
|
@ -43,14 +43,15 @@ class PackageInfo(RepositoryProperties):
|
|||||||
Returns:
|
Returns:
|
||||||
list[Package]: list of read packages
|
list[Package]: list of read packages
|
||||||
"""
|
"""
|
||||||
|
sources = {package.base: package.remote for package, _, in self.reporter.package_get(None)}
|
||||||
|
|
||||||
result: dict[str, Package] = {}
|
result: dict[str, Package] = {}
|
||||||
# we are iterating over bases, not single packages
|
# we are iterating over bases, not single packages
|
||||||
for full_path in packages:
|
for full_path in packages:
|
||||||
try:
|
try:
|
||||||
local = Package.from_archive(full_path, self.pacman)
|
local = Package.from_archive(full_path, self.pacman)
|
||||||
remote, _ = next(iter(self.reporter.package_get(local.base)), (None, None))
|
if (source := sources.get(local.base)) is not None: # update source with remote
|
||||||
if remote is not None: # update source with remote
|
local.remote = source
|
||||||
local.remote = remote.remote
|
|
||||||
|
|
||||||
current = result.setdefault(local.base, local)
|
current = result.setdefault(local.base, local)
|
||||||
if current.version != local.version:
|
if current.version != local.version:
|
||||||
|
@ -79,19 +79,6 @@ class Client:
|
|||||||
|
|
||||||
return make_local_client()
|
return make_local_client()
|
||||||
|
|
||||||
def package_add(self, package: Package, status: BuildStatusEnum) -> None:
|
|
||||||
"""
|
|
||||||
add new package with status
|
|
||||||
|
|
||||||
Args:
|
|
||||||
package(Package): package properties
|
|
||||||
status(BuildStatusEnum): current package build status
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
NotImplementedError: not implemented method
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def package_changes_get(self, package_base: str) -> Changes:
|
def package_changes_get(self, package_base: str) -> Changes:
|
||||||
"""
|
"""
|
||||||
get package changes
|
get package changes
|
||||||
@ -258,9 +245,9 @@ class Client:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def package_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
def package_status_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
||||||
"""
|
"""
|
||||||
update package build status. Unlike :func:`package_add()` it does not update package properties
|
update package build status. Unlike :func:`package_update()` it does not update package properties
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
package_base(str): package base to update
|
package_base(str): package base to update
|
||||||
@ -271,6 +258,19 @@ class Client:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def package_update(self, package: Package, status: BuildStatusEnum) -> None:
|
||||||
|
"""
|
||||||
|
add new package or update existing one with status
|
||||||
|
|
||||||
|
Args:
|
||||||
|
package(Package): package properties
|
||||||
|
status(BuildStatusEnum): current package build status
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotImplementedError: not implemented method
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def set_building(self, package_base: str) -> None:
|
def set_building(self, package_base: str) -> None:
|
||||||
"""
|
"""
|
||||||
set package status to building
|
set package status to building
|
||||||
@ -278,7 +278,7 @@ class Client:
|
|||||||
Args:
|
Args:
|
||||||
package_base(str): package base to update
|
package_base(str): package base to update
|
||||||
"""
|
"""
|
||||||
return self.package_update(package_base, BuildStatusEnum.Building)
|
return self.package_status_update(package_base, BuildStatusEnum.Building)
|
||||||
|
|
||||||
def set_failed(self, package_base: str) -> None:
|
def set_failed(self, package_base: str) -> None:
|
||||||
"""
|
"""
|
||||||
@ -287,7 +287,7 @@ class Client:
|
|||||||
Args:
|
Args:
|
||||||
package_base(str): package base to update
|
package_base(str): package base to update
|
||||||
"""
|
"""
|
||||||
return self.package_update(package_base, BuildStatusEnum.Failed)
|
return self.package_status_update(package_base, BuildStatusEnum.Failed)
|
||||||
|
|
||||||
def set_pending(self, package_base: str) -> None:
|
def set_pending(self, package_base: str) -> None:
|
||||||
"""
|
"""
|
||||||
@ -296,7 +296,7 @@ class Client:
|
|||||||
Args:
|
Args:
|
||||||
package_base(str): package base to update
|
package_base(str): package base to update
|
||||||
"""
|
"""
|
||||||
return self.package_update(package_base, BuildStatusEnum.Pending)
|
return self.package_status_update(package_base, BuildStatusEnum.Pending)
|
||||||
|
|
||||||
def set_success(self, package: Package) -> None:
|
def set_success(self, package: Package) -> None:
|
||||||
"""
|
"""
|
||||||
@ -305,7 +305,7 @@ class Client:
|
|||||||
Args:
|
Args:
|
||||||
package(Package): current package properties
|
package(Package): current package properties
|
||||||
"""
|
"""
|
||||||
return self.package_add(package, BuildStatusEnum.Success)
|
return self.package_update(package, BuildStatusEnum.Success)
|
||||||
|
|
||||||
def set_unknown(self, package: Package) -> None:
|
def set_unknown(self, package: Package) -> None:
|
||||||
"""
|
"""
|
||||||
@ -314,7 +314,7 @@ class Client:
|
|||||||
Args:
|
Args:
|
||||||
package(Package): current package properties
|
package(Package): current package properties
|
||||||
"""
|
"""
|
||||||
return self.package_add(package, BuildStatusEnum.Unknown)
|
return self.package_update(package, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
def status_get(self) -> InternalStatus:
|
def status_get(self) -> InternalStatus:
|
||||||
"""
|
"""
|
||||||
|
@ -48,17 +48,6 @@ class LocalClient(Client):
|
|||||||
self.database = database
|
self.database = database
|
||||||
self.repository_id = repository_id
|
self.repository_id = repository_id
|
||||||
|
|
||||||
def package_add(self, package: Package, status: BuildStatusEnum) -> None:
|
|
||||||
"""
|
|
||||||
add new package with status
|
|
||||||
|
|
||||||
Args:
|
|
||||||
package(Package): package properties
|
|
||||||
status(BuildStatusEnum): current package build status
|
|
||||||
"""
|
|
||||||
self.database.package_update(package, self.repository_id)
|
|
||||||
self.database.status_update(package.base, BuildStatus(status), self.repository_id)
|
|
||||||
|
|
||||||
def package_changes_get(self, package_base: str) -> Changes:
|
def package_changes_get(self, package_base: str) -> Changes:
|
||||||
"""
|
"""
|
||||||
get package changes
|
get package changes
|
||||||
@ -197,12 +186,29 @@ class LocalClient(Client):
|
|||||||
"""
|
"""
|
||||||
self.database.package_clear(package_base)
|
self.database.package_clear(package_base)
|
||||||
|
|
||||||
def package_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
def package_status_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
||||||
"""
|
"""
|
||||||
update package build status. Unlike :func:`package_add()` it does not update package properties
|
update package build status. Unlike :func:`package_update()` it does not update package properties
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
package_base(str): package base to update
|
package_base(str): package base to update
|
||||||
status(BuildStatusEnum): current package build status
|
status(BuildStatusEnum): current package build status
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotImplementedError: not implemented method
|
||||||
"""
|
"""
|
||||||
self.database.status_update(package_base, BuildStatus(status), self.repository_id)
|
self.database.status_update(package_base, BuildStatus(status), self.repository_id)
|
||||||
|
|
||||||
|
def package_update(self, package: Package, status: BuildStatusEnum) -> None:
|
||||||
|
"""
|
||||||
|
add new package or update existing one with status
|
||||||
|
|
||||||
|
Args:
|
||||||
|
package(Package): package properties
|
||||||
|
status(BuildStatusEnum): current package build status
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotImplementedError: not implemented method
|
||||||
|
"""
|
||||||
|
self.database.package_update(package, self.repository_id)
|
||||||
|
self.database.status_update(package.base, BuildStatus(status), self.repository_id)
|
||||||
|
@ -78,18 +78,6 @@ class Watcher(LazyLogging):
|
|||||||
for package, status in self.client.package_get(None)
|
for package, status in self.client.package_get(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
def package_add(self, package: Package, status: BuildStatusEnum) -> None:
|
|
||||||
"""
|
|
||||||
update package
|
|
||||||
|
|
||||||
Args:
|
|
||||||
package(Package): package description
|
|
||||||
status(BuildStatusEnum): new build status
|
|
||||||
"""
|
|
||||||
with self._lock:
|
|
||||||
self._known[package.base] = (package, BuildStatus(status))
|
|
||||||
self.client.package_add(package, status)
|
|
||||||
|
|
||||||
package_changes_get: Callable[[str], Changes]
|
package_changes_get: Callable[[str], Changes]
|
||||||
|
|
||||||
package_changes_update: Callable[[str, Changes], None]
|
package_changes_update: Callable[[str, Changes], None]
|
||||||
@ -154,7 +142,7 @@ class Watcher(LazyLogging):
|
|||||||
self.client.package_remove(package_base)
|
self.client.package_remove(package_base)
|
||||||
self.package_logs_remove(package_base, None)
|
self.package_logs_remove(package_base, None)
|
||||||
|
|
||||||
def package_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
def package_status_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
||||||
"""
|
"""
|
||||||
update package status
|
update package status
|
||||||
|
|
||||||
@ -165,7 +153,19 @@ class Watcher(LazyLogging):
|
|||||||
package, _ = self.package_get(package_base)
|
package, _ = self.package_get(package_base)
|
||||||
with self._lock:
|
with self._lock:
|
||||||
self._known[package_base] = (package, BuildStatus(status))
|
self._known[package_base] = (package, BuildStatus(status))
|
||||||
self.client.package_update(package_base, status)
|
self.client.package_status_update(package_base, status)
|
||||||
|
|
||||||
|
def package_update(self, package: Package, status: BuildStatusEnum) -> None:
|
||||||
|
"""
|
||||||
|
update package
|
||||||
|
|
||||||
|
Args:
|
||||||
|
package(Package): package description
|
||||||
|
status(BuildStatusEnum): new build status
|
||||||
|
"""
|
||||||
|
with self._lock:
|
||||||
|
self._known[package.base] = (package, BuildStatus(status))
|
||||||
|
self.client.package_update(package, status)
|
||||||
|
|
||||||
def status_update(self, status: BuildStatusEnum) -> None:
|
def status_update(self, status: BuildStatusEnum) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -157,22 +157,6 @@ class WebClient(Client, SyncAhrimanClient):
|
|||||||
"""
|
"""
|
||||||
return f"{self.address}/api/v1/status"
|
return f"{self.address}/api/v1/status"
|
||||||
|
|
||||||
def package_add(self, package: Package, status: BuildStatusEnum) -> None:
|
|
||||||
"""
|
|
||||||
add new package with status
|
|
||||||
|
|
||||||
Args:
|
|
||||||
package(Package): package properties
|
|
||||||
status(BuildStatusEnum): current package build status
|
|
||||||
"""
|
|
||||||
payload = {
|
|
||||||
"status": status.value,
|
|
||||||
"package": package.view()
|
|
||||||
}
|
|
||||||
with contextlib.suppress(Exception):
|
|
||||||
self.make_request("POST", self._package_url(package.base),
|
|
||||||
params=self.repository_id.query(), json=payload)
|
|
||||||
|
|
||||||
def package_changes_get(self, package_base: str) -> Changes:
|
def package_changes_get(self, package_base: str) -> Changes:
|
||||||
"""
|
"""
|
||||||
get package changes
|
get package changes
|
||||||
@ -365,19 +349,41 @@ class WebClient(Client, SyncAhrimanClient):
|
|||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
self.make_request("DELETE", self._package_url(package_base), params=self.repository_id.query())
|
self.make_request("DELETE", self._package_url(package_base), params=self.repository_id.query())
|
||||||
|
|
||||||
def package_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
def package_status_update(self, package_base: str, status: BuildStatusEnum) -> None:
|
||||||
"""
|
"""
|
||||||
update package build status. Unlike :func:`package_add()` it does not update package properties
|
update package build status. Unlike :func:`package_update()` it does not update package properties
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
package_base(str): package base to update
|
package_base(str): package base to update
|
||||||
status(BuildStatusEnum): current package build status
|
status(BuildStatusEnum): current package build status
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotImplementedError: not implemented method
|
||||||
"""
|
"""
|
||||||
payload = {"status": status.value}
|
payload = {"status": status.value}
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
self.make_request("POST", self._package_url(package_base),
|
self.make_request("POST", self._package_url(package_base),
|
||||||
params=self.repository_id.query(), json=payload)
|
params=self.repository_id.query(), json=payload)
|
||||||
|
|
||||||
|
def package_update(self, package: Package, status: BuildStatusEnum) -> None:
|
||||||
|
"""
|
||||||
|
add new package or update existing one with status
|
||||||
|
|
||||||
|
Args:
|
||||||
|
package(Package): package properties
|
||||||
|
status(BuildStatusEnum): current package build status
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotImplementedError: not implemented method
|
||||||
|
"""
|
||||||
|
payload = {
|
||||||
|
"status": status.value,
|
||||||
|
"package": package.view(),
|
||||||
|
}
|
||||||
|
with contextlib.suppress(Exception):
|
||||||
|
self.make_request("POST", self._package_url(package.base),
|
||||||
|
params=self.repository_id.query(), json=payload)
|
||||||
|
|
||||||
def status_get(self) -> InternalStatus:
|
def status_get(self) -> InternalStatus:
|
||||||
"""
|
"""
|
||||||
get internal service status
|
get internal service status
|
||||||
|
@ -25,6 +25,7 @@ from typing import TypeVar
|
|||||||
from ahriman.core.auth import Auth
|
from ahriman.core.auth import Auth
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.distributed import WorkersCache
|
from ahriman.core.distributed import WorkersCache
|
||||||
|
from ahriman.core.exceptions import UnknownPackageError
|
||||||
from ahriman.core.sign.gpg import GPG
|
from ahriman.core.sign.gpg import GPG
|
||||||
from ahriman.core.spawn import Spawn
|
from ahriman.core.spawn import Spawn
|
||||||
from ahriman.core.status.watcher import Watcher
|
from ahriman.core.status.watcher import Watcher
|
||||||
@ -238,6 +239,8 @@ class BaseView(View, CorsViewMixin):
|
|||||||
return self.services[repository_id](package_base)
|
return self.services[repository_id](package_base)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise HTTPNotFound(reason=f"Repository {repository_id.id} is unknown")
|
raise HTTPNotFound(reason=f"Repository {repository_id.id} is unknown")
|
||||||
|
except UnknownPackageError:
|
||||||
|
raise HTTPNotFound(reason=f"Package {package_base} is unknown")
|
||||||
|
|
||||||
async def username(self) -> str | None:
|
async def username(self) -> str | None:
|
||||||
"""
|
"""
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#
|
#
|
||||||
import aiohttp_apispec # type: ignore[import-untyped]
|
import aiohttp_apispec # type: ignore[import-untyped]
|
||||||
|
|
||||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response
|
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||||
|
|
||||||
from ahriman.core.exceptions import UnknownPackageError
|
|
||||||
from ahriman.models.changes import Changes
|
from ahriman.models.changes import Changes
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
from ahriman.web.schemas import AuthSchema, ChangesSchema, ErrorSchema, PackageNameSchema, RepositoryIdSchema
|
from ahriman.web.schemas import AuthSchema, ChangesSchema, ErrorSchema, PackageNameSchema, RepositoryIdSchema
|
||||||
@ -70,10 +69,7 @@ class ChangesView(StatusViewGuard, BaseView):
|
|||||||
"""
|
"""
|
||||||
package_base = self.request.match_info["package"]
|
package_base = self.request.match_info["package"]
|
||||||
|
|
||||||
try:
|
changes = self.service(package_base=package_base).package_changes_get(package_base)
|
||||||
changes = self.service(package_base=package_base).package_changes_get(package_base)
|
|
||||||
except UnknownPackageError:
|
|
||||||
raise HTTPNotFound(reason=f"Package {package_base} is unknown")
|
|
||||||
|
|
||||||
return json_response(changes.view())
|
return json_response(changes.view())
|
||||||
|
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#
|
#
|
||||||
import aiohttp_apispec # type: ignore[import-untyped]
|
import aiohttp_apispec # type: ignore[import-untyped]
|
||||||
|
|
||||||
from aiohttp.web import HTTPBadRequest, HTTPNoContent, HTTPNotFound, Response, json_response
|
from aiohttp.web import HTTPBadRequest, HTTPNoContent, Response, json_response
|
||||||
|
|
||||||
from ahriman.core.exceptions import UnknownPackageError
|
|
||||||
from ahriman.models.dependencies import Dependencies
|
from ahriman.models.dependencies import Dependencies
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
from ahriman.web.schemas import AuthSchema, DependenciesSchema, ErrorSchema, PackageNameSchema, RepositoryIdSchema
|
from ahriman.web.schemas import AuthSchema, DependenciesSchema, ErrorSchema, PackageNameSchema, RepositoryIdSchema
|
||||||
@ -70,10 +69,7 @@ class DependenciesView(StatusViewGuard, BaseView):
|
|||||||
"""
|
"""
|
||||||
package_base = self.request.match_info["package"]
|
package_base = self.request.match_info["package"]
|
||||||
|
|
||||||
try:
|
dependencies = self.service(package_base=package_base).package_dependencies_get(package_base)
|
||||||
dependencies = self.service(package_base=package_base).package_dependencies_get(package_base)
|
|
||||||
except UnknownPackageError:
|
|
||||||
raise HTTPNotFound(reason=f"Package {package_base} is unknown")
|
|
||||||
|
|
||||||
return json_response(dependencies.view())
|
return json_response(dependencies.view())
|
||||||
|
|
||||||
@ -112,9 +108,6 @@ class DependenciesView(StatusViewGuard, BaseView):
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise HTTPBadRequest(reason=str(ex))
|
raise HTTPBadRequest(reason=str(ex))
|
||||||
|
|
||||||
try:
|
self.service(package_base=package_base).package_dependencies_update(package_base, dependencies)
|
||||||
self.service(package_base=package_base).package_dependencies_update(package_base, dependencies)
|
|
||||||
except UnknownPackageError:
|
|
||||||
raise HTTPNotFound(reason=f"Package {package_base} is unknown")
|
|
||||||
|
|
||||||
raise HTTPNoContent
|
raise HTTPNoContent
|
||||||
|
@ -153,9 +153,9 @@ class PackageView(StatusViewGuard, BaseView):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if package is None:
|
if package is None:
|
||||||
self.service().package_update(package_base, status)
|
self.service().package_status_update(package_base, status)
|
||||||
else:
|
else:
|
||||||
self.service().package_add(package, status)
|
self.service().package_update(package, status)
|
||||||
except UnknownPackageError:
|
except UnknownPackageError:
|
||||||
raise HTTPBadRequest(reason=f"Package {package_base} is unknown, but no package body set")
|
raise HTTPBadRequest(reason=f"Package {package_base} is unknown, but no package body set")
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ class PatchView(StatusViewGuard, BaseView):
|
|||||||
"""
|
"""
|
||||||
package_base = self.request.match_info["package"]
|
package_base = self.request.match_info["package"]
|
||||||
variable = self.request.match_info["patch"]
|
variable = self.request.match_info["patch"]
|
||||||
|
|
||||||
self.service().package_patches_remove(package_base, variable)
|
self.service().package_patches_remove(package_base, variable)
|
||||||
|
|
||||||
raise HTTPNoContent
|
raise HTTPNoContent
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#
|
#
|
||||||
import aiohttp_apispec # type: ignore[import-untyped]
|
import aiohttp_apispec # type: ignore[import-untyped]
|
||||||
|
|
||||||
from aiohttp.web import HTTPNotFound, Response, json_response
|
from aiohttp.web import Response, json_response
|
||||||
|
|
||||||
from ahriman.core.exceptions import UnknownPackageError
|
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
from ahriman.web.schemas import AuthSchema, ErrorSchema, LogSchema, PackageNameSchema, PaginationSchema
|
from ahriman.web.schemas import AuthSchema, ErrorSchema, LogSchema, PackageNameSchema, PaginationSchema
|
||||||
from ahriman.web.views.base import BaseView
|
from ahriman.web.views.base import BaseView
|
||||||
@ -68,10 +67,8 @@ class LogsView(StatusViewGuard, BaseView):
|
|||||||
"""
|
"""
|
||||||
package_base = self.request.match_info["package"]
|
package_base = self.request.match_info["package"]
|
||||||
limit, offset = self.page()
|
limit, offset = self.page()
|
||||||
try:
|
|
||||||
logs = self.service(package_base=package_base).package_logs_get(package_base, limit, offset)
|
logs = self.service(package_base=package_base).package_logs_get(package_base, limit, offset)
|
||||||
except UnknownPackageError:
|
|
||||||
raise HTTPNotFound(reason=f"Package {package_base} is unknown")
|
|
||||||
|
|
||||||
response = [
|
response = [
|
||||||
{
|
{
|
||||||
|
@ -94,14 +94,6 @@ def test_load_web_client_from_legacy_unix_socket(configuration: Configuration, d
|
|||||||
assert isinstance(Client.load(repository_id, configuration, database, report=True), WebClient)
|
assert isinstance(Client.load(repository_id, configuration, database, report=True), WebClient)
|
||||||
|
|
||||||
|
|
||||||
def test_package_add(client: Client, package_ahriman: Package) -> None:
|
|
||||||
"""
|
|
||||||
must raise not implemented on package addition
|
|
||||||
"""
|
|
||||||
with pytest.raises(NotImplementedError):
|
|
||||||
client.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_changes_get(client: Client, package_ahriman: Package) -> None:
|
def test_package_changes_get(client: Client, package_ahriman: Package) -> None:
|
||||||
"""
|
"""
|
||||||
must raise not implemented on package changes request
|
must raise not implemented on package changes request
|
||||||
@ -198,19 +190,27 @@ def test_package_remove(client: Client, package_ahriman: Package) -> None:
|
|||||||
client.package_remove(package_ahriman.base)
|
client.package_remove(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
def test_package_update(client: Client, package_ahriman: Package) -> None:
|
def test_package_status_update(client: Client, package_ahriman: Package) -> None:
|
||||||
"""
|
"""
|
||||||
must raise not implemented on package update
|
must raise not implemented on package update
|
||||||
"""
|
"""
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
client.package_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
client.package_status_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update(client: Client, package_ahriman: Package) -> None:
|
||||||
|
"""
|
||||||
|
must raise not implemented on package addition
|
||||||
|
"""
|
||||||
|
with pytest.raises(NotImplementedError):
|
||||||
|
client.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
def test_set_building(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_set_building(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must set building status to the package
|
must set building status to the package
|
||||||
"""
|
"""
|
||||||
update_mock = mocker.patch("ahriman.core.status.Client.package_update")
|
update_mock = mocker.patch("ahriman.core.status.Client.package_status_update")
|
||||||
client.set_building(package_ahriman.base)
|
client.set_building(package_ahriman.base)
|
||||||
|
|
||||||
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Building)
|
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Building)
|
||||||
@ -220,7 +220,7 @@ def test_set_failed(client: Client, package_ahriman: Package, mocker: MockerFixt
|
|||||||
"""
|
"""
|
||||||
must set failed status to the package
|
must set failed status to the package
|
||||||
"""
|
"""
|
||||||
update_mock = mocker.patch("ahriman.core.status.Client.package_update")
|
update_mock = mocker.patch("ahriman.core.status.Client.package_status_update")
|
||||||
client.set_failed(package_ahriman.base)
|
client.set_failed(package_ahriman.base)
|
||||||
|
|
||||||
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Failed)
|
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Failed)
|
||||||
@ -230,7 +230,7 @@ def test_set_pending(client: Client, package_ahriman: Package, mocker: MockerFix
|
|||||||
"""
|
"""
|
||||||
must set building status to the package
|
must set building status to the package
|
||||||
"""
|
"""
|
||||||
update_mock = mocker.patch("ahriman.core.status.Client.package_update")
|
update_mock = mocker.patch("ahriman.core.status.Client.package_status_update")
|
||||||
client.set_pending(package_ahriman.base)
|
client.set_pending(package_ahriman.base)
|
||||||
|
|
||||||
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Pending)
|
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Pending)
|
||||||
@ -240,7 +240,7 @@ def test_set_success(client: Client, package_ahriman: Package, mocker: MockerFix
|
|||||||
"""
|
"""
|
||||||
must set success status to the package
|
must set success status to the package
|
||||||
"""
|
"""
|
||||||
add_mock = mocker.patch("ahriman.core.status.Client.package_add")
|
add_mock = mocker.patch("ahriman.core.status.Client.package_update")
|
||||||
client.set_success(package_ahriman)
|
client.set_success(package_ahriman)
|
||||||
|
|
||||||
add_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Success)
|
add_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Success)
|
||||||
@ -250,7 +250,7 @@ def test_set_unknown(client: Client, package_ahriman: Package, mocker: MockerFix
|
|||||||
"""
|
"""
|
||||||
must add new package with unknown status
|
must add new package with unknown status
|
||||||
"""
|
"""
|
||||||
add_mock = mocker.patch("ahriman.core.status.Client.package_add")
|
add_mock = mocker.patch("ahriman.core.status.Client.package_update")
|
||||||
client.set_unknown(package_ahriman)
|
client.set_unknown(package_ahriman)
|
||||||
|
|
||||||
add_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Unknown)
|
add_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
@ -12,18 +12,6 @@ from ahriman.models.package import Package
|
|||||||
from ahriman.models.pkgbuild_patch import PkgbuildPatch
|
from ahriman.models.pkgbuild_patch import PkgbuildPatch
|
||||||
|
|
||||||
|
|
||||||
def test_package_add(local_client: LocalClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must process package addition
|
|
||||||
"""
|
|
||||||
package_mock = mocker.patch("ahriman.core.database.SQLite.package_update")
|
|
||||||
status_mock = mocker.patch("ahriman.core.database.SQLite.status_update")
|
|
||||||
|
|
||||||
local_client.package_add(package_ahriman, BuildStatusEnum.Success)
|
|
||||||
package_mock.assert_called_once_with(package_ahriman, local_client.repository_id)
|
|
||||||
status_mock.assert_called_once_with(package_ahriman.base, pytest.helpers.anyvar(int), local_client.repository_id)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_changes_get(local_client: LocalClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_package_changes_get(local_client: LocalClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must retrieve package changes
|
must retrieve package changes
|
||||||
@ -173,10 +161,22 @@ def test_package_remove(local_client: LocalClient, package_ahriman: Package, moc
|
|||||||
package_mock.assert_called_once_with(package_ahriman.base)
|
package_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
def test_package_update(local_client: LocalClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_package_status_update(local_client: LocalClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must update package status
|
must update package status
|
||||||
"""
|
"""
|
||||||
status_mock = mocker.patch("ahriman.core.database.SQLite.status_update")
|
status_mock = mocker.patch("ahriman.core.database.SQLite.status_update")
|
||||||
local_client.package_update(package_ahriman.base, BuildStatusEnum.Success)
|
local_client.package_status_update(package_ahriman.base, BuildStatusEnum.Success)
|
||||||
|
status_mock.assert_called_once_with(package_ahriman.base, pytest.helpers.anyvar(int), local_client.repository_id)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update(local_client: LocalClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must process package addition
|
||||||
|
"""
|
||||||
|
package_mock = mocker.patch("ahriman.core.database.SQLite.package_update")
|
||||||
|
status_mock = mocker.patch("ahriman.core.database.SQLite.status_update")
|
||||||
|
|
||||||
|
local_client.package_update(package_ahriman, BuildStatusEnum.Success)
|
||||||
|
package_mock.assert_called_once_with(package_ahriman, local_client.repository_id)
|
||||||
status_mock.assert_called_once_with(package_ahriman.base, pytest.helpers.anyvar(int), local_client.repository_id)
|
status_mock.assert_called_once_with(package_ahriman.base, pytest.helpers.anyvar(int), local_client.repository_id)
|
||||||
|
@ -46,17 +46,6 @@ def test_load_known(watcher: Watcher, package_ahriman: Package, mocker: MockerFi
|
|||||||
assert status.status == BuildStatusEnum.Success
|
assert status.status == BuildStatusEnum.Success
|
||||||
|
|
||||||
|
|
||||||
def test_package_add(watcher: Watcher, package_ahriman: Package, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must add package to cache
|
|
||||||
"""
|
|
||||||
cache_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_add")
|
|
||||||
|
|
||||||
watcher.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
assert watcher.packages
|
|
||||||
cache_mock.assert_called_once_with(package_ahriman, pytest.helpers.anyvar(int))
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_get(watcher: Watcher, package_ahriman: Package) -> None:
|
def test_package_get(watcher: Watcher, package_ahriman: Package) -> None:
|
||||||
"""
|
"""
|
||||||
must return package status
|
must return package status
|
||||||
@ -130,26 +119,37 @@ def test_package_remove_unknown(watcher: Watcher, package_ahriman: Package, mock
|
|||||||
cache_mock.assert_called_once_with(package_ahriman.base)
|
cache_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
def test_package_update(watcher: Watcher, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_package_status_update(watcher: Watcher, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must update package status only for known package
|
must update package status only for known package
|
||||||
"""
|
"""
|
||||||
cache_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_update")
|
cache_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_status_update")
|
||||||
watcher._known = {package_ahriman.base: (package_ahriman, BuildStatus())}
|
watcher._known = {package_ahriman.base: (package_ahriman, BuildStatus())}
|
||||||
|
|
||||||
watcher.package_update(package_ahriman.base, BuildStatusEnum.Success)
|
watcher.package_status_update(package_ahriman.base, BuildStatusEnum.Success)
|
||||||
cache_mock.assert_called_once_with(package_ahriman.base, pytest.helpers.anyvar(int))
|
cache_mock.assert_called_once_with(package_ahriman.base, pytest.helpers.anyvar(int))
|
||||||
package, status = watcher._known[package_ahriman.base]
|
package, status = watcher._known[package_ahriman.base]
|
||||||
assert package == package_ahriman
|
assert package == package_ahriman
|
||||||
assert status.status == BuildStatusEnum.Success
|
assert status.status == BuildStatusEnum.Success
|
||||||
|
|
||||||
|
|
||||||
def test_package_update_unknown(watcher: Watcher, package_ahriman: Package) -> None:
|
def test_package_status_update_unknown(watcher: Watcher, package_ahriman: Package) -> None:
|
||||||
"""
|
"""
|
||||||
must fail on unknown package status update only
|
must fail on unknown package status update only
|
||||||
"""
|
"""
|
||||||
with pytest.raises(UnknownPackageError):
|
with pytest.raises(UnknownPackageError):
|
||||||
watcher.package_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
watcher.package_status_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update(watcher: Watcher, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must add package to cache
|
||||||
|
"""
|
||||||
|
cache_mock = mocker.patch("ahriman.core.status.local_client.LocalClient.package_update")
|
||||||
|
|
||||||
|
watcher.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
assert watcher.packages
|
||||||
|
cache_mock.assert_called_once_with(package_ahriman, pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_status_update(watcher: Watcher) -> None:
|
def test_status_update(watcher: Watcher) -> None:
|
||||||
|
@ -97,59 +97,6 @@ def test_status_url(web_client: WebClient) -> None:
|
|||||||
assert web_client._status_url().endswith("/api/v1/status")
|
assert web_client._status_url().endswith("/api/v1/status")
|
||||||
|
|
||||||
|
|
||||||
def test_package_add(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must process package addition
|
|
||||||
"""
|
|
||||||
requests_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request")
|
|
||||||
payload = pytest.helpers.get_package_status(package_ahriman)
|
|
||||||
|
|
||||||
web_client.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
requests_mock.assert_called_once_with("POST", pytest.helpers.anyvar(str, True),
|
|
||||||
params=web_client.repository_id.query(), json=payload)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_add_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must suppress any exception happened during addition
|
|
||||||
"""
|
|
||||||
mocker.patch("requests.Session.request", side_effect=Exception())
|
|
||||||
web_client.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_add_failed_http_error(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must suppress HTTP exception happened during addition
|
|
||||||
"""
|
|
||||||
mocker.patch("requests.Session.request", side_effect=requests.HTTPError())
|
|
||||||
web_client.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_add_failed_suppress(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must suppress any exception happened during addition and don't log
|
|
||||||
"""
|
|
||||||
web_client.suppress_errors = True
|
|
||||||
mocker.patch("requests.Session.request", side_effect=Exception())
|
|
||||||
logging_mock = mocker.patch("logging.exception")
|
|
||||||
|
|
||||||
web_client.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
logging_mock.assert_not_called()
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_add_failed_http_error_suppress(web_client: WebClient, package_ahriman: Package,
|
|
||||||
mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must suppress HTTP exception happened during addition and don't log
|
|
||||||
"""
|
|
||||||
web_client.suppress_errors = True
|
|
||||||
mocker.patch("requests.Session.request", side_effect=requests.HTTPError())
|
|
||||||
logging_mock = mocker.patch("logging.exception")
|
|
||||||
|
|
||||||
web_client.package_add(package_ahriman, BuildStatusEnum.Unknown)
|
|
||||||
logging_mock.assert_not_called()
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_changes_get(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_package_changes_get(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must get changes
|
must get changes
|
||||||
@ -785,13 +732,13 @@ def test_package_remove_failed_http_error(web_client: WebClient, package_ahriman
|
|||||||
web_client.package_remove(package_ahriman.base)
|
web_client.package_remove(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
def test_package_update(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_package_status_update(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must process package update
|
must process package update
|
||||||
"""
|
"""
|
||||||
requests_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request")
|
requests_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request")
|
||||||
|
|
||||||
web_client.package_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
web_client.package_status_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
||||||
requests_mock.assert_called_once_with("POST", pytest.helpers.anyvar(str, True),
|
requests_mock.assert_called_once_with("POST", pytest.helpers.anyvar(str, True),
|
||||||
params=web_client.repository_id.query(),
|
params=web_client.repository_id.query(),
|
||||||
json={
|
json={
|
||||||
@ -799,21 +746,75 @@ def test_package_update(web_client: WebClient, package_ahriman: Package, mocker:
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def test_package_update_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_package_status_update_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must suppress any exception happened during update
|
must suppress any exception happened during update
|
||||||
"""
|
"""
|
||||||
mocker.patch("requests.Session.request", side_effect=Exception())
|
mocker.patch("requests.Session.request", side_effect=Exception())
|
||||||
web_client.package_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
web_client.package_status_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_status_update_failed_http_error(web_client: WebClient, package_ahriman: Package,
|
||||||
|
mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must suppress HTTP exception happened during update
|
||||||
|
"""
|
||||||
|
mocker.patch("requests.Session.request", side_effect=requests.HTTPError())
|
||||||
|
web_client.package_status_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must process package addition
|
||||||
|
"""
|
||||||
|
requests_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request")
|
||||||
|
payload = pytest.helpers.get_package_status(package_ahriman)
|
||||||
|
|
||||||
|
web_client.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
requests_mock.assert_called_once_with("POST", pytest.helpers.anyvar(str, True),
|
||||||
|
params=web_client.repository_id.query(), json=payload)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must suppress any exception happened during addition
|
||||||
|
"""
|
||||||
|
mocker.patch("requests.Session.request", side_effect=Exception())
|
||||||
|
web_client.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
def test_package_update_failed_http_error(web_client: WebClient, package_ahriman: Package,
|
def test_package_update_failed_http_error(web_client: WebClient, package_ahriman: Package,
|
||||||
mocker: MockerFixture) -> None:
|
mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must suppress HTTP exception happened during update
|
must suppress HTTP exception happened during addition
|
||||||
"""
|
"""
|
||||||
mocker.patch("requests.Session.request", side_effect=requests.HTTPError())
|
mocker.patch("requests.Session.request", side_effect=requests.HTTPError())
|
||||||
web_client.package_update(package_ahriman.base, BuildStatusEnum.Unknown)
|
web_client.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update_failed_suppress(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must suppress any exception happened during addition and don't log
|
||||||
|
"""
|
||||||
|
web_client.suppress_errors = True
|
||||||
|
mocker.patch("requests.Session.request", side_effect=Exception())
|
||||||
|
logging_mock = mocker.patch("logging.exception")
|
||||||
|
|
||||||
|
web_client.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
logging_mock.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
|
def test_package_update_failed_http_error_suppress(web_client: WebClient, package_ahriman: Package,
|
||||||
|
mocker: MockerFixture) -> None:
|
||||||
|
"""
|
||||||
|
must suppress HTTP exception happened during addition and don't log
|
||||||
|
"""
|
||||||
|
web_client.suppress_errors = True
|
||||||
|
mocker.patch("requests.Session.request", side_effect=requests.HTTPError())
|
||||||
|
logging_mock = mocker.patch("logging.exception")
|
||||||
|
|
||||||
|
web_client.package_update(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
logging_mock.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
def test_status_get(web_client: WebClient, mocker: MockerFixture) -> None:
|
def test_status_get(web_client: WebClient, mocker: MockerFixture) -> None:
|
||||||
|
@ -7,7 +7,6 @@ from pytest_mock import MockerFixture
|
|||||||
from unittest.mock import AsyncMock
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
from ahriman.core.configuration import Configuration
|
from ahriman.core.configuration import Configuration
|
||||||
from ahriman.core.exceptions import UnknownPackageError
|
|
||||||
from ahriman.models.repository_id import RepositoryId
|
from ahriman.models.repository_id import RepositoryId
|
||||||
from ahriman.models.user_access import UserAccess
|
from ahriman.models.user_access import UserAccess
|
||||||
from ahriman.web.keys import WatcherKey
|
from ahriman.web.keys import WatcherKey
|
||||||
@ -210,7 +209,7 @@ def test_service_package(base: BaseView, repository_id: RepositoryId, mocker: Mo
|
|||||||
must validate that package exists
|
must validate that package exists
|
||||||
"""
|
"""
|
||||||
mocker.patch("ahriman.web.views.base.BaseView.repository_id", return_value=repository_id)
|
mocker.patch("ahriman.web.views.base.BaseView.repository_id", return_value=repository_id)
|
||||||
with pytest.raises(UnknownPackageError):
|
with pytest.raises(HTTPNotFound):
|
||||||
base.service(package_base="base")
|
base.service(package_base="base")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user