mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-11-04 15:53:41 +00:00
feat: allow to use one application for multiple repositories (#111)
* allow to use one application for multiple repositories * update tests * handle None append argument everywhere * rewrite repository definition logic * drop optional flags from docs * support of new schema in systemd units * add migration docs and ability to migrate tree automatically * use repostory id instead * verbose multiarchitectureerror * object path support for s3 sync * fix tests after rebase
This commit is contained in:
40
tests/ahriman/models/test_repository_id.py
Normal file
40
tests/ahriman/models/test_repository_id.py
Normal file
@ -0,0 +1,40 @@
|
||||
import pytest
|
||||
|
||||
from ahriman.models.repository_id import RepositoryId
|
||||
|
||||
|
||||
def test_is_empty() -> None:
|
||||
"""
|
||||
must check if repository id is empty or not
|
||||
"""
|
||||
assert RepositoryId("", "").is_empty
|
||||
assert RepositoryId("arch", "").is_empty
|
||||
assert RepositoryId("", "repo").is_empty
|
||||
assert not RepositoryId("arch", "repo").is_empty
|
||||
|
||||
|
||||
def test_id() -> None:
|
||||
"""
|
||||
must correctly generate id
|
||||
"""
|
||||
assert RepositoryId("", "").id == "-"
|
||||
assert RepositoryId("arch", "repo").id == "arch-repo"
|
||||
|
||||
|
||||
def test_lt() -> None:
|
||||
"""
|
||||
must correctly compare instances
|
||||
"""
|
||||
assert RepositoryId("x86_64", "a") < RepositoryId("x86_64", "b")
|
||||
assert RepositoryId("x86_64", "b") > RepositoryId("x86_64", "a")
|
||||
|
||||
assert RepositoryId("i686", "a") < RepositoryId("x86_64", "a")
|
||||
assert RepositoryId("x86_64", "a") > RepositoryId("i686", "a")
|
||||
|
||||
|
||||
def test_lt_invalid() -> None:
|
||||
"""
|
||||
must raise ValueError if other is not valid repository id
|
||||
"""
|
||||
with pytest.raises(ValueError):
|
||||
RepositoryId("x86_64", "a") < 42
|
||||
Reference in New Issue
Block a user