shorten public imports

This commit is contained in:
2022-05-06 04:08:05 +03:00
parent 33e9fea47c
commit 98910240dd
139 changed files with 374 additions and 373 deletions

View File

@ -1,4 +1,4 @@
from ahriman.core.database.sqlite import SQLite
from ahriman.core.database import SQLite
from ahriman.models.user import User
from ahriman.models.user_access import UserAccess

View File

@ -1,4 +1,4 @@
from ahriman.core.database.sqlite import SQLite
from ahriman.core.database import SQLite
from ahriman.models.package import Package

View File

@ -3,7 +3,7 @@ import sqlite3
from pytest_mock import MockerFixture
from unittest.mock import MagicMock
from ahriman.core.database.sqlite import SQLite
from ahriman.core.database import SQLite
def test_factory(database: SQLite) -> None:

View File

@ -4,7 +4,7 @@ from pytest_mock import MockerFixture
from sqlite3 import Connection
from unittest import mock
from ahriman.core.database.sqlite import SQLite
from ahriman.core.database import SQLite
from ahriman.models.build_status import BuildStatus, BuildStatusEnum
from ahriman.models.package import Package
from ahriman.models.package_source import PackageSource
@ -97,8 +97,8 @@ def test_package_remove(database: SQLite, package_ahriman: Package, mocker: Mock
"""
must totally remove package from the database
"""
remove_package_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._package_remove_package_base")
remove_packages_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._package_remove_packages")
remove_package_mock = mocker.patch("ahriman.core.database.SQLite._package_remove_package_base")
remove_packages_mock = mocker.patch("ahriman.core.database.SQLite._package_remove_packages")
database.package_remove(package_ahriman.base)
remove_package_mock.assert_called_once_with(pytest.helpers.anyvar(int), package_ahriman.base)
@ -110,10 +110,10 @@ def test_package_update(database: SQLite, package_ahriman: Package, mocker: Mock
must update package status
"""
status = BuildStatus()
insert_base_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._package_update_insert_base")
insert_status_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._package_update_insert_status")
insert_packages_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._package_update_insert_packages")
remove_packages_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._package_remove_packages")
insert_base_mock = mocker.patch("ahriman.core.database.SQLite._package_update_insert_base")
insert_status_mock = mocker.patch("ahriman.core.database.SQLite._package_update_insert_status")
insert_packages_mock = mocker.patch("ahriman.core.database.SQLite._package_update_insert_packages")
remove_packages_mock = mocker.patch("ahriman.core.database.SQLite._package_remove_packages")
database.package_update(package_ahriman, status)
insert_base_mock.assert_called_once_with(pytest.helpers.anyvar(int), package_ahriman)
@ -127,10 +127,10 @@ def test_packages_get(database: SQLite, package_ahriman: Package, mocker: Mocker
"""
must return all packages
"""
select_bases_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._packages_get_select_package_bases",
select_bases_mock = mocker.patch("ahriman.core.database.SQLite._packages_get_select_package_bases",
return_value={package_ahriman.base: package_ahriman})
select_packages_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._packages_get_select_packages")
select_statuses_mock = mocker.patch("ahriman.core.database.sqlite.SQLite._packages_get_select_statuses")
select_packages_mock = mocker.patch("ahriman.core.database.SQLite._packages_get_select_packages")
select_statuses_mock = mocker.patch("ahriman.core.database.SQLite._packages_get_select_statuses")
database.packages_get()
select_bases_mock.assert_called_once_with(pytest.helpers.anyvar(int))

View File

@ -1,4 +1,4 @@
from ahriman.core.database.sqlite import SQLite
from ahriman.core.database import SQLite
from ahriman.models.package import Package

View File

@ -3,14 +3,14 @@ import pytest
from pytest_mock import MockerFixture
from ahriman.core.configuration import Configuration
from ahriman.core.database.sqlite import SQLite
from ahriman.core.database import SQLite
def test_load(configuration: Configuration, mocker: MockerFixture) -> None:
"""
must correctly load instance
"""
init_mock = mocker.patch("ahriman.core.database.sqlite.SQLite.init")
init_mock = mocker.patch("ahriman.core.database.SQLite.init")
SQLite.load(configuration)
init_mock.assert_called_once_with(configuration)