Ejemplo n.º 1
0
def test_sign_skip(application: Application, package_ahriman: Package,
                   mocker: MockerFixture) -> None:
    """
    must skip sign packages with empty filename
    """
    package_ahriman.packages[package_ahriman.base].filename = None
    mocker.patch("ahriman.core.repository.repository.Repository.packages",
                 return_value=[package_ahriman])
    mocker.patch("ahriman.application.application.Application.update")

    application.sign([])
Ejemplo n.º 2
0
def test_sign_specific(application: Application, package_ahriman: Package,
                       package_python_schedule: Package,
                       mocker: MockerFixture) -> None:
    """
    must sign only specified packages
    """
    mocker.patch("ahriman.core.repository.repository.Repository.packages",
                 return_value=[package_ahriman, package_python_schedule])
    copy_mock = mocker.patch("shutil.copy")
    update_mock = mocker.patch(
        "ahriman.application.application.Application.update")
    sign_repository_mock = mocker.patch(
        "ahriman.core.sign.gpg.GPG.sign_repository")
    finalize_mock = mocker.patch(
        "ahriman.application.application.Application._finalize")

    application.sign([package_ahriman.base])
    copy_mock.assert_called_once()
    update_mock.assert_called_with([])
    sign_repository_mock.assert_called_once()
    finalize_mock.assert_called_once()
Ejemplo n.º 3
0
def test_sign(application: Application, package_ahriman: Package,
              package_python_schedule: Package, mocker: MockerFixture) -> None:
    """
    must sign world
    """
    mocker.patch("ahriman.core.repository.repository.Repository.packages",
                 return_value=[package_ahriman, package_python_schedule])
    copy_mock = mocker.patch("shutil.copy")
    update_mock = mocker.patch(
        "ahriman.application.application.Application.update")
    sign_repository_mock = mocker.patch(
        "ahriman.core.sign.gpg.GPG.sign_repository")
    finalize_mock = mocker.patch(
        "ahriman.application.application.Application._finalize")

    application.sign([])
    copy_mock.assert_has_calls([
        mock.call(pytest.helpers.anyvar(str), pytest.helpers.anyvar(str)),
        mock.call(pytest.helpers.anyvar(str), pytest.helpers.anyvar(str))
    ])
    update_mock.assert_called_with([])
    sign_repository_mock.assert_called_once()
    finalize_mock.assert_called_once()