mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 23:37:18 +00:00
* Allow to use single web instance for any repository * some improvements * drop includes from user home directory, introduce new variables to docker The old solution didn't actually work as expected, because devtools configuration belongs to filesystem (as well as sudo one), so it was still required to run setup command. In order to handle additional repositories, the POSTSETUP and PRESETUP commands variables have been introduced. FAQ has been updated as well * raise 404 in case if repository is unknown
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
import pytest
|
|
|
|
from pytest_mock import MockerFixture
|
|
|
|
from ahriman.core.exceptions import MigrationError
|
|
from ahriman.models.migration_result import MigrationResult
|
|
|
|
|
|
def test_is_outdated() -> None:
|
|
"""
|
|
must return False for outdated schema
|
|
"""
|
|
assert MigrationResult(old_version=0, new_version=1).is_outdated
|
|
assert not MigrationResult(old_version=1, new_version=1).is_outdated
|
|
|
|
|
|
def test_is_outdated_validation(mocker: MockerFixture) -> None:
|
|
"""
|
|
must call validation before version check
|
|
"""
|
|
validate_mock = mocker.patch("ahriman.models.migration_result.MigrationResult.validate")
|
|
assert MigrationResult(old_version=0, new_version=1).is_outdated
|
|
validate_mock.assert_called_once_with()
|
|
|
|
|
|
def test_validate() -> None:
|
|
"""
|
|
must raise exception on invalid migration versions
|
|
"""
|
|
with pytest.raises(MigrationError):
|
|
MigrationResult(old_version=-1, new_version=0).validate()
|
|
|
|
with pytest.raises(MigrationError):
|
|
MigrationResult(old_version=1, new_version=0).validate()
|