mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
exactly one called with instead of last call check
This commit is contained in:
parent
fcb167b1a3
commit
4502931c39
@ -12,9 +12,9 @@ Wrapper for managing custom repository inspired by [repo-scripts](https://github
|
|||||||
* Multi-architecture support.
|
* Multi-architecture support.
|
||||||
* VCS packages support.
|
* VCS packages support.
|
||||||
* Sign support with gpg (repository, package, per package settings).
|
* Sign support with gpg (repository, package, per package settings).
|
||||||
* Synchronization to remote services (rsync, s3) and report generation (html).
|
* Synchronization to remote services (rsync, s3 and github) and report generation (html).
|
||||||
* Dependency manager.
|
* Dependency manager.
|
||||||
* Ability to patch AUR packages.
|
* Ability to patch AUR packages and even create package from local PKGBUILDs.
|
||||||
* Repository status interface with optional authorization and control options:
|
* Repository status interface with optional authorization and control options:
|
||||||
|
|
||||||

|

|
||||||
|
@ -70,7 +70,7 @@ def test_patch_set_list(application: Application, mocker: MockerFixture) -> None
|
|||||||
print_mock = mocker.patch("ahriman.application.handlers.patch.Patch._print")
|
print_mock = mocker.patch("ahriman.application.handlers.patch.Patch._print")
|
||||||
|
|
||||||
Patch.patch_set_list(application, "ahriman")
|
Patch.patch_set_list(application, "ahriman")
|
||||||
glob_mock.assert_called_with("*.patch")
|
glob_mock.assert_called_once_with("*.patch")
|
||||||
print_mock.assert_called()
|
print_mock.assert_called()
|
||||||
|
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ def test_patch_set_create(application: Application, package_ahriman: Package, mo
|
|||||||
patch_dir = application.repository.paths.patches_for(package_ahriman.base)
|
patch_dir = application.repository.paths.patches_for(package_ahriman.base)
|
||||||
|
|
||||||
Patch.patch_set_create(application, Path("path"), ["*.patch"])
|
Patch.patch_set_create(application, Path("path"), ["*.patch"])
|
||||||
create_mock.assert_called_with(Path("path"), patch_dir / "00-main.patch", "*.patch")
|
create_mock.assert_called_once_with(Path("path"), patch_dir / "00-main.patch", "*.patch")
|
||||||
|
|
||||||
|
|
||||||
def test_patch_set_create_clear(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_patch_set_create_clear(application: Application, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -120,4 +120,4 @@ def test_patch_set_remove(application: Application, package_ahriman: Package, mo
|
|||||||
patch_dir = application.repository.paths.patches_for(package_ahriman.base)
|
patch_dir = application.repository.paths.patches_for(package_ahriman.base)
|
||||||
|
|
||||||
Patch.patch_set_remove(application, package_ahriman.base)
|
Patch.patch_set_remove(application, package_ahriman.base)
|
||||||
remove_mock.assert_called_with(patch_dir, ignore_errors=True)
|
remove_mock.assert_called_once_with(patch_dir, ignore_errors=True)
|
||||||
|
@ -45,7 +45,7 @@ def test_run_filter(args: argparse.Namespace, configuration: Configuration,
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.update")
|
application_mock = mocker.patch("ahriman.application.application.Application.update")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True)
|
Rebuild.run(args, "x86_64", configuration, True)
|
||||||
application_mock.assert_called_with([package_ahriman])
|
application_mock.assert_called_once_with([package_ahriman])
|
||||||
|
|
||||||
|
|
||||||
def test_run_without_filter(args: argparse.Namespace, configuration: Configuration,
|
def test_run_without_filter(args: argparse.Namespace, configuration: Configuration,
|
||||||
@ -61,4 +61,4 @@ def test_run_without_filter(args: argparse.Namespace, configuration: Configurati
|
|||||||
application_mock = mocker.patch("ahriman.application.application.Application.update")
|
application_mock = mocker.patch("ahriman.application.application.Application.update")
|
||||||
|
|
||||||
Rebuild.run(args, "x86_64", configuration, True)
|
Rebuild.run(args, "x86_64", configuration, True)
|
||||||
application_mock.assert_called_with([package_ahriman, package_python_schedule])
|
application_mock.assert_called_once_with([package_ahriman, package_python_schedule])
|
||||||
|
@ -47,7 +47,7 @@ def test_run_dry_run(args: argparse.Namespace, configuration: Configuration, pac
|
|||||||
RemoveUnknown.run(args, "x86_64", configuration, True)
|
RemoveUnknown.run(args, "x86_64", configuration, True)
|
||||||
application_mock.assert_called_once()
|
application_mock.assert_called_once()
|
||||||
remove_mock.assert_not_called()
|
remove_mock.assert_not_called()
|
||||||
log_fn_mock.assert_called_with(package_ahriman)
|
log_fn_mock.assert_called_once_with(package_ahriman)
|
||||||
|
|
||||||
|
|
||||||
def test_log_fn(package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_log_fn(package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
@ -39,7 +39,7 @@ def test_run_multiple_search(args: argparse.Namespace, configuration: Configurat
|
|||||||
search_mock = mocker.patch("aur.search")
|
search_mock = mocker.patch("aur.search")
|
||||||
|
|
||||||
Search.run(args, "x86_64", configuration, True)
|
Search.run(args, "x86_64", configuration, True)
|
||||||
search_mock.assert_called_with(" ".join(args.search))
|
search_mock.assert_called_once_with(" ".join(args.search))
|
||||||
|
|
||||||
|
|
||||||
def test_log_fn(args: argparse.Namespace, configuration: Configuration, aur_package_ahriman: aur.Package,
|
def test_log_fn(args: argparse.Namespace, configuration: Configuration, aur_package_ahriman: aur.Package,
|
||||||
|
@ -134,7 +134,7 @@ def test_create_sudo_configuration(args: argparse.Namespace, mocker: MockerFixtu
|
|||||||
write_text_mock = mocker.patch("pathlib.Path.write_text")
|
write_text_mock = mocker.patch("pathlib.Path.write_text")
|
||||||
|
|
||||||
Setup.create_sudo_configuration(args.build_command, "x86_64")
|
Setup.create_sudo_configuration(args.build_command, "x86_64")
|
||||||
chmod_text_mock.assert_called_with(0o400)
|
chmod_text_mock.assert_called_once_with(0o400)
|
||||||
write_text_mock.assert_called_once()
|
write_text_mock.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ def test_run_with_package_filter(args: argparse.Namespace, configuration: Config
|
|||||||
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
return_value=[(package_ahriman, BuildStatus(BuildStatusEnum.Success))])
|
||||||
|
|
||||||
Status.run(args, "x86_64", configuration, True)
|
Status.run(args, "x86_64", configuration, True)
|
||||||
packages_mock.assert_called_with(package_ahriman.base)
|
packages_mock.assert_called_once_with(package_ahriman.base)
|
||||||
|
|
||||||
|
|
||||||
def test_run_by_status(args: argparse.Namespace, configuration: Configuration, package_ahriman: Package,
|
def test_run_by_status(args: argparse.Namespace, configuration: Configuration, package_ahriman: Package,
|
||||||
|
@ -41,7 +41,7 @@ def test_get_updates_all(application: Application, package_ahriman: Package, moc
|
|||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application.get_updates([], no_aur=False, no_manual=False, no_vcs=False, log_fn=print)
|
application.get_updates([], no_aur=False, no_manual=False, no_vcs=False, log_fn=print)
|
||||||
updates_aur_mock.assert_called_with([], False)
|
updates_aur_mock.assert_called_once_with([], False)
|
||||||
updates_manual_mock.assert_called_once()
|
updates_manual_mock.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ def test_get_updates_no_manual(application: Application, mocker: MockerFixture)
|
|||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application.get_updates([], no_aur=False, no_manual=True, no_vcs=False, log_fn=print)
|
application.get_updates([], no_aur=False, no_manual=True, no_vcs=False, log_fn=print)
|
||||||
updates_aur_mock.assert_called_with([], False)
|
updates_aur_mock.assert_called_once_with([], False)
|
||||||
updates_manual_mock.assert_not_called()
|
updates_manual_mock.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ def test_get_updates_no_vcs(application: Application, mocker: MockerFixture) ->
|
|||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application.get_updates([], no_aur=False, no_manual=False, no_vcs=True, log_fn=print)
|
application.get_updates([], no_aur=False, no_manual=False, no_vcs=True, log_fn=print)
|
||||||
updates_aur_mock.assert_called_with([], True)
|
updates_aur_mock.assert_called_once_with([], True)
|
||||||
updates_manual_mock.assert_called_once()
|
updates_manual_mock.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ def test_get_updates_with_filter(application: Application, mocker: MockerFixture
|
|||||||
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
updates_manual_mock = mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.updates_manual")
|
||||||
|
|
||||||
application.get_updates(["filter"], no_aur=False, no_manual=False, no_vcs=False, log_fn=print)
|
application.get_updates(["filter"], no_aur=False, no_manual=False, no_vcs=False, log_fn=print)
|
||||||
updates_aur_mock.assert_called_with(["filter"], False)
|
updates_aur_mock.assert_called_once_with(["filter"], False)
|
||||||
updates_manual_mock.assert_called_once()
|
updates_manual_mock.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ def test_sign(application: Application, package_ahriman: Package, package_python
|
|||||||
mock.call(pytest.helpers.anyvar(str), pytest.helpers.anyvar(str)),
|
mock.call(pytest.helpers.anyvar(str), pytest.helpers.anyvar(str)),
|
||||||
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([])
|
update_mock.assert_called_once_with([])
|
||||||
sign_repository_mock.assert_called_once()
|
sign_repository_mock.assert_called_once()
|
||||||
finalize_mock.assert_called_once()
|
finalize_mock.assert_called_once()
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ def test_sign_specific(application: Application, package_ahriman: Package, packa
|
|||||||
|
|
||||||
application.sign([package_ahriman.base])
|
application.sign([package_ahriman.base])
|
||||||
copy_mock.assert_called_once()
|
copy_mock.assert_called_once()
|
||||||
update_mock.assert_called_with([])
|
update_mock.assert_called_once_with([])
|
||||||
sign_repository_mock.assert_called_once()
|
sign_repository_mock.assert_called_once()
|
||||||
finalize_mock.assert_called_once()
|
finalize_mock.assert_called_once()
|
||||||
|
|
||||||
@ -366,5 +366,5 @@ def test_update(application: Application, package_ahriman: Package, mocker: Mock
|
|||||||
|
|
||||||
application.update([package_ahriman])
|
application.update([package_ahriman])
|
||||||
build_mock.assert_called_once()
|
build_mock.assert_called_once()
|
||||||
update_mock.assert_called_with(paths)
|
update_mock.assert_called_once_with(paths)
|
||||||
finalize_mock.assert_called_with([package_ahriman])
|
finalize_mock.assert_called_once_with([package_ahriman])
|
||||||
|
@ -58,7 +58,7 @@ def test_get_oauth_url(oauth: OAuth, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
authorize_url_mock = mocker.patch("aioauth_client.GoogleClient.get_authorize_url")
|
authorize_url_mock = mocker.patch("aioauth_client.GoogleClient.get_authorize_url")
|
||||||
oauth.get_oauth_url()
|
oauth.get_oauth_url()
|
||||||
authorize_url_mock.assert_called_with(scope=oauth.scopes, redirect_uri=oauth.redirect_uri)
|
authorize_url_mock.assert_called_once_with(scope=oauth.scopes, redirect_uri=oauth.redirect_uri)
|
||||||
|
|
||||||
|
|
||||||
async def test_get_oauth_username(oauth: OAuth, mocker: MockerFixture) -> None:
|
async def test_get_oauth_username(oauth: OAuth, mocker: MockerFixture) -> None:
|
||||||
@ -70,7 +70,7 @@ async def test_get_oauth_username(oauth: OAuth, mocker: MockerFixture) -> None:
|
|||||||
return_value=(aioauth_client.User(email="email"), ""))
|
return_value=(aioauth_client.User(email="email"), ""))
|
||||||
|
|
||||||
email = await oauth.get_oauth_username("code")
|
email = await oauth.get_oauth_username("code")
|
||||||
access_token_mock.assert_called_with("code", redirect_uri=oauth.redirect_uri)
|
access_token_mock.assert_called_once_with("code", redirect_uri=oauth.redirect_uri)
|
||||||
user_info_mock.assert_called_once()
|
user_info_mock.assert_called_once()
|
||||||
assert email == "email"
|
assert email == "email"
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ def test_add(mocker: MockerFixture) -> None:
|
|||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.add(local, "pattern1", "pattern2")
|
Sources.add(local, "pattern1", "pattern2")
|
||||||
glob_mock.assert_has_calls([mock.call("pattern1"), mock.call("pattern2")])
|
glob_mock.assert_has_calls([mock.call("pattern1"), mock.call("pattern2")])
|
||||||
check_output_mock.assert_called_with(
|
check_output_mock.assert_called_once_with(
|
||||||
"git", "add", "--intent-to-add", "1", "2", "1", "2",
|
"git", "add", "--intent-to-add", "1", "2", "1", "2",
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
@ -32,7 +32,8 @@ def test_diff(mocker: MockerFixture) -> None:
|
|||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.diff(local, Path("patch"))
|
Sources.diff(local, Path("patch"))
|
||||||
write_mock.assert_called_once()
|
write_mock.assert_called_once()
|
||||||
check_output_mock.assert_called_with("git", "diff", exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
check_output_mock.assert_called_once_with("git", "diff",
|
||||||
|
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_fetch_empty(mocker: MockerFixture) -> None:
|
def test_fetch_empty(mocker: MockerFixture) -> None:
|
||||||
@ -93,7 +94,8 @@ def test_has_remotes(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
local = Path("local")
|
local = Path("local")
|
||||||
assert Sources.has_remotes(local)
|
assert Sources.has_remotes(local)
|
||||||
check_output_mock.assert_called_with("git", "remote", exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
check_output_mock.assert_called_once_with("git", "remote",
|
||||||
|
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_has_remotes_empty(mocker: MockerFixture) -> None:
|
def test_has_remotes_empty(mocker: MockerFixture) -> None:
|
||||||
@ -112,8 +114,8 @@ def test_init(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
local = Path("local")
|
local = Path("local")
|
||||||
Sources.init(local)
|
Sources.init(local)
|
||||||
check_output_mock.assert_called_with("git", "init", "--initial-branch", Sources._branch,
|
check_output_mock.assert_called_once_with("git", "init", "--initial-branch", Sources._branch,
|
||||||
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
exception=None, cwd=local, logger=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_load(mocker: MockerFixture) -> None:
|
def test_load(mocker: MockerFixture) -> None:
|
||||||
@ -124,8 +126,8 @@ def test_load(mocker: MockerFixture) -> None:
|
|||||||
patch_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.patch_apply")
|
patch_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.patch_apply")
|
||||||
|
|
||||||
Sources.load(Path("local"), "remote", Path("patches"))
|
Sources.load(Path("local"), "remote", Path("patches"))
|
||||||
fetch_mock.assert_called_with(Path("local"), "remote")
|
fetch_mock.assert_called_once_with(Path("local"), "remote")
|
||||||
patch_mock.assert_called_with(Path("local"), Path("patches"))
|
patch_mock.assert_called_once_with(Path("local"), Path("patches"))
|
||||||
|
|
||||||
|
|
||||||
def test_patch_apply(mocker: MockerFixture) -> None:
|
def test_patch_apply(mocker: MockerFixture) -> None:
|
||||||
@ -178,5 +180,5 @@ def test_patch_create(mocker: MockerFixture) -> None:
|
|||||||
diff_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.diff")
|
diff_mock = mocker.patch("ahriman.core.build_tools.sources.Sources.diff")
|
||||||
|
|
||||||
Sources.patch_create(Path("local"), Path("patch"), "glob")
|
Sources.patch_create(Path("local"), Path("patch"), "glob")
|
||||||
add_mock.assert_called_with(Path("local"), "glob")
|
add_mock.assert_called_once_with(Path("local"), "glob")
|
||||||
diff_mock.assert_called_with(Path("local"), Path("patch"))
|
diff_mock.assert_called_once_with(Path("local"), Path("patch"))
|
||||||
|
@ -68,7 +68,7 @@ def test_process_remove_base(executor: Executor, package_ahriman: Package, mocke
|
|||||||
# must remove via alpm wrapper
|
# must remove via alpm wrapper
|
||||||
repo_remove_mock.assert_called_once()
|
repo_remove_mock.assert_called_once()
|
||||||
# must update status and remove package files
|
# must update status and remove package files
|
||||||
tree_clear_mock.assert_called_with(package_ahriman.base)
|
tree_clear_mock.assert_called_once_with(package_ahriman.base)
|
||||||
status_client_mock.assert_called_once()
|
status_client_mock.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ def test_process_update_group(executor: Executor, package_python_schedule: Packa
|
|||||||
mock.call(executor.paths.repository / package.filepath)
|
mock.call(executor.paths.repository / package.filepath)
|
||||||
for package in package_python_schedule.packages.values()
|
for package in package_python_schedule.packages.values()
|
||||||
], any_order=True)
|
], any_order=True)
|
||||||
status_client_mock.assert_called_with(package_python_schedule)
|
status_client_mock.assert_called_once_with(package_python_schedule)
|
||||||
|
|
||||||
|
|
||||||
def test_process_empty_filename(executor: Executor, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_process_empty_filename(executor: Executor, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
|
@ -96,7 +96,7 @@ def test_set_building(client: Client, package_ahriman: Package, mocker: MockerFi
|
|||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
||||||
client.set_building(package_ahriman.base)
|
client.set_building(package_ahriman.base)
|
||||||
|
|
||||||
update_mock.assert_called_with(package_ahriman.base, BuildStatusEnum.Building)
|
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Building)
|
||||||
|
|
||||||
|
|
||||||
def test_set_failed(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_set_failed(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -106,7 +106,7 @@ def test_set_failed(client: Client, package_ahriman: Package, mocker: MockerFixt
|
|||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
||||||
client.set_failed(package_ahriman.base)
|
client.set_failed(package_ahriman.base)
|
||||||
|
|
||||||
update_mock.assert_called_with(package_ahriman.base, BuildStatusEnum.Failed)
|
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Failed)
|
||||||
|
|
||||||
|
|
||||||
def test_set_pending(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_set_pending(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -116,7 +116,7 @@ def test_set_pending(client: Client, package_ahriman: Package, mocker: MockerFix
|
|||||||
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
update_mock = mocker.patch("ahriman.core.status.client.Client.update")
|
||||||
client.set_pending(package_ahriman.base)
|
client.set_pending(package_ahriman.base)
|
||||||
|
|
||||||
update_mock.assert_called_with(package_ahriman.base, BuildStatusEnum.Pending)
|
update_mock.assert_called_once_with(package_ahriman.base, BuildStatusEnum.Pending)
|
||||||
|
|
||||||
|
|
||||||
def test_set_success(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_set_success(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -126,7 +126,7 @@ def test_set_success(client: Client, package_ahriman: Package, mocker: MockerFix
|
|||||||
add_mock = mocker.patch("ahriman.core.status.client.Client.add")
|
add_mock = mocker.patch("ahriman.core.status.client.Client.add")
|
||||||
client.set_success(package_ahriman)
|
client.set_success(package_ahriman)
|
||||||
|
|
||||||
add_mock.assert_called_with(package_ahriman, BuildStatusEnum.Success)
|
add_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Success)
|
||||||
|
|
||||||
|
|
||||||
def test_set_unknown(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_set_unknown(client: Client, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -136,4 +136,4 @@ def test_set_unknown(client: Client, package_ahriman: Package, mocker: MockerFix
|
|||||||
add_mock = mocker.patch("ahriman.core.status.client.Client.add")
|
add_mock = mocker.patch("ahriman.core.status.client.Client.add")
|
||||||
client.set_unknown(package_ahriman)
|
client.set_unknown(package_ahriman)
|
||||||
|
|
||||||
add_mock.assert_called_with(package_ahriman, BuildStatusEnum.Unknown)
|
add_mock.assert_called_once_with(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
|
@ -53,7 +53,7 @@ def test_login(web_client: WebClient, user: User, mocker: MockerFixture) -> None
|
|||||||
}
|
}
|
||||||
|
|
||||||
web_client._login()
|
web_client._login()
|
||||||
requests_mock.assert_called_with(pytest.helpers.anyvar(str, True), json=payload)
|
requests_mock.assert_called_once_with(pytest.helpers.anyvar(str, True), json=payload)
|
||||||
|
|
||||||
|
|
||||||
def test_login_failed(web_client: WebClient, user: User, mocker: MockerFixture) -> None:
|
def test_login_failed(web_client: WebClient, user: User, mocker: MockerFixture) -> None:
|
||||||
@ -99,7 +99,7 @@ def test_add(web_client: WebClient, package_ahriman: Package, mocker: MockerFixt
|
|||||||
payload = pytest.helpers.get_package_status(package_ahriman)
|
payload = pytest.helpers.get_package_status(package_ahriman)
|
||||||
|
|
||||||
web_client.add(package_ahriman, BuildStatusEnum.Unknown)
|
web_client.add(package_ahriman, BuildStatusEnum.Unknown)
|
||||||
requests_mock.assert_called_with(pytest.helpers.anyvar(str, True), json=payload)
|
requests_mock.assert_called_once_with(pytest.helpers.anyvar(str, True), json=payload)
|
||||||
|
|
||||||
|
|
||||||
def test_add_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_add_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -237,7 +237,7 @@ def test_reload_auth(web_client: WebClient, mocker: MockerFixture) -> None:
|
|||||||
requests_mock = mocker.patch("requests.Session.post")
|
requests_mock = mocker.patch("requests.Session.post")
|
||||||
|
|
||||||
web_client.reload_auth()
|
web_client.reload_auth()
|
||||||
requests_mock.assert_called_with(pytest.helpers.anyvar(str, True))
|
requests_mock.assert_called_once_with(pytest.helpers.anyvar(str, True))
|
||||||
|
|
||||||
|
|
||||||
def test_reload_auth_failed(web_client: WebClient, mocker: MockerFixture) -> None:
|
def test_reload_auth_failed(web_client: WebClient, mocker: MockerFixture) -> None:
|
||||||
@ -263,7 +263,7 @@ def test_remove(web_client: WebClient, package_ahriman: Package, mocker: MockerF
|
|||||||
requests_mock = mocker.patch("requests.Session.delete")
|
requests_mock = mocker.patch("requests.Session.delete")
|
||||||
|
|
||||||
web_client.remove(package_ahriman.base)
|
web_client.remove(package_ahriman.base)
|
||||||
requests_mock.assert_called_with(pytest.helpers.anyvar(str, True))
|
requests_mock.assert_called_once_with(pytest.helpers.anyvar(str, True))
|
||||||
|
|
||||||
|
|
||||||
def test_remove_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_remove_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -289,7 +289,8 @@ def test_update(web_client: WebClient, package_ahriman: Package, mocker: MockerF
|
|||||||
requests_mock = mocker.patch("requests.Session.post")
|
requests_mock = mocker.patch("requests.Session.post")
|
||||||
|
|
||||||
web_client.update(package_ahriman.base, BuildStatusEnum.Unknown)
|
web_client.update(package_ahriman.base, BuildStatusEnum.Unknown)
|
||||||
requests_mock.assert_called_with(pytest.helpers.anyvar(str, True), json={"status": BuildStatusEnum.Unknown.value})
|
requests_mock.assert_called_once_with(pytest.helpers.anyvar(str, True), json={
|
||||||
|
"status": BuildStatusEnum.Unknown.value})
|
||||||
|
|
||||||
|
|
||||||
def test_update_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
def test_update_failed(web_client: WebClient, package_ahriman: Package, mocker: MockerFixture) -> None:
|
||||||
@ -315,7 +316,8 @@ def test_update_self(web_client: WebClient, mocker: MockerFixture) -> None:
|
|||||||
requests_mock = mocker.patch("requests.Session.post")
|
requests_mock = mocker.patch("requests.Session.post")
|
||||||
|
|
||||||
web_client.update_self(BuildStatusEnum.Unknown)
|
web_client.update_self(BuildStatusEnum.Unknown)
|
||||||
requests_mock.assert_called_with(pytest.helpers.anyvar(str, True), json={"status": BuildStatusEnum.Unknown.value})
|
requests_mock.assert_called_once_with(pytest.helpers.anyvar(str, True), json={
|
||||||
|
"status": BuildStatusEnum.Unknown.value})
|
||||||
|
|
||||||
|
|
||||||
def test_update_self_failed(web_client: WebClient, mocker: MockerFixture) -> None:
|
def test_update_self_failed(web_client: WebClient, mocker: MockerFixture) -> None:
|
||||||
|
@ -19,7 +19,7 @@ def test_from_path(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
configuration = Configuration.from_path(path, "x86_64", True)
|
configuration = Configuration.from_path(path, "x86_64", True)
|
||||||
assert configuration.path == path
|
assert configuration.path == path
|
||||||
read_mock.assert_called_with(path)
|
read_mock.assert_called_once_with(path)
|
||||||
load_includes_mock.assert_called_once()
|
load_includes_mock.assert_called_once()
|
||||||
load_logging_mock.assert_called_once()
|
load_logging_mock.assert_called_once()
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ def test_process(spawner: Spawn) -> None:
|
|||||||
|
|
||||||
spawner.process(callback, args, spawner.architecture, "id", spawner.queue)
|
spawner.process(callback, args, spawner.architecture, "id", spawner.queue)
|
||||||
|
|
||||||
callback.assert_called_with(args, spawner.architecture)
|
callback.assert_called_once_with(args, spawner.architecture)
|
||||||
(uuid, status) = spawner.queue.get()
|
(uuid, status) = spawner.queue.get()
|
||||||
assert uuid == "id"
|
assert uuid == "id"
|
||||||
assert status
|
assert status
|
||||||
@ -42,7 +42,7 @@ def test_packages_add(spawner: Spawn, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
||||||
spawner.packages_add(["ahriman", "linux"], now=False)
|
spawner.packages_add(["ahriman", "linux"], now=False)
|
||||||
spawn_mock.assert_called_with("add", "ahriman", "linux", source="aur")
|
spawn_mock.assert_called_once_with("add", "ahriman", "linux", source="aur")
|
||||||
|
|
||||||
|
|
||||||
def test_packages_add_with_build(spawner: Spawn, mocker: MockerFixture) -> None:
|
def test_packages_add_with_build(spawner: Spawn, mocker: MockerFixture) -> None:
|
||||||
@ -51,7 +51,7 @@ def test_packages_add_with_build(spawner: Spawn, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
||||||
spawner.packages_add(["ahriman", "linux"], now=True)
|
spawner.packages_add(["ahriman", "linux"], now=True)
|
||||||
spawn_mock.assert_called_with("add", "ahriman", "linux", source="aur", now="")
|
spawn_mock.assert_called_once_with("add", "ahriman", "linux", source="aur", now="")
|
||||||
|
|
||||||
|
|
||||||
def test_packages_remove(spawner: Spawn, mocker: MockerFixture) -> None:
|
def test_packages_remove(spawner: Spawn, mocker: MockerFixture) -> None:
|
||||||
@ -60,7 +60,7 @@ def test_packages_remove(spawner: Spawn, mocker: MockerFixture) -> None:
|
|||||||
"""
|
"""
|
||||||
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
||||||
spawner.packages_remove(["ahriman", "linux"])
|
spawner.packages_remove(["ahriman", "linux"])
|
||||||
spawn_mock.assert_called_with("remove", "ahriman", "linux")
|
spawn_mock.assert_called_once_with("remove", "ahriman", "linux")
|
||||||
|
|
||||||
|
|
||||||
def test_spawn_process(spawner: Spawn, mocker: MockerFixture) -> None:
|
def test_spawn_process(spawner: Spawn, mocker: MockerFixture) -> None:
|
||||||
@ -71,7 +71,7 @@ def test_spawn_process(spawner: Spawn, mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
spawner.spawn_process("add", "ahriman", now="", maybe="?")
|
spawner.spawn_process("add", "ahriman", now="", maybe="?")
|
||||||
start_mock.assert_called_once()
|
start_mock.assert_called_once()
|
||||||
spawner.args_parser.parse_args.assert_called_with([
|
spawner.args_parser.parse_args.assert_called_once_with([
|
||||||
"--architecture", spawner.architecture, "--configuration", str(spawner.configuration.path),
|
"--architecture", spawner.architecture, "--configuration", str(spawner.configuration.path),
|
||||||
"add", "ahriman", "--now", "--maybe", "?"
|
"add", "ahriman", "--now", "--maybe", "?"
|
||||||
])
|
])
|
||||||
|
@ -70,7 +70,7 @@ def test_asset_remove(github: Github, github_release: Dict[str, Any], mocker: Mo
|
|||||||
"""
|
"""
|
||||||
request_mock = mocker.patch("ahriman.core.upload.github.Github._request")
|
request_mock = mocker.patch("ahriman.core.upload.github.Github._request")
|
||||||
github.asset_remove(github_release, "asset_name")
|
github.asset_remove(github_release, "asset_name")
|
||||||
request_mock.assert_called_with("DELETE", "asset_url")
|
request_mock.assert_called_once_with("DELETE", "asset_url")
|
||||||
|
|
||||||
|
|
||||||
def test_asset_remove_unknown(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
def test_asset_remove_unknown(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||||
@ -91,8 +91,8 @@ def test_asset_upload(github: Github, github_release: Dict[str, Any], mocker: Mo
|
|||||||
remove_mock = mocker.patch("ahriman.core.upload.github.Github.asset_remove")
|
remove_mock = mocker.patch("ahriman.core.upload.github.Github.asset_remove")
|
||||||
|
|
||||||
github.asset_upload(github_release, Path("/root/new.tar.xz"))
|
github.asset_upload(github_release, Path("/root/new.tar.xz"))
|
||||||
request_mock.assert_called_with("POST", "upload_url", params={"name": "new.tar.xz"},
|
request_mock.assert_called_once_with("POST", "upload_url", params={"name": "new.tar.xz"},
|
||||||
data=b"", headers={"Content-Type": "application/x-tar"})
|
data=b"", headers={"Content-Type": "application/x-tar"})
|
||||||
remove_mock.assert_not_called()
|
remove_mock.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
@ -105,10 +105,11 @@ def test_asset_upload_with_removal(github: Github, github_release: Dict[str, Any
|
|||||||
remove_mock = mocker.patch("ahriman.core.upload.github.Github.asset_remove")
|
remove_mock = mocker.patch("ahriman.core.upload.github.Github.asset_remove")
|
||||||
|
|
||||||
github.asset_upload(github_release, Path("asset_name"))
|
github.asset_upload(github_release, Path("asset_name"))
|
||||||
remove_mock.assert_called_with(github_release, "asset_name")
|
|
||||||
|
|
||||||
github.asset_upload(github_release, Path("/root/asset_name"))
|
github.asset_upload(github_release, Path("/root/asset_name"))
|
||||||
remove_mock.assert_called_with(github_release, "asset_name")
|
remove_mock.assert_has_calls([
|
||||||
|
mock.call(github_release, "asset_name"),
|
||||||
|
mock.call(github_release, "asset_name"),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_asset_upload_empty_mimetype(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
def test_asset_upload_empty_mimetype(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||||
@ -121,8 +122,8 @@ def test_asset_upload_empty_mimetype(github: Github, github_release: Dict[str, A
|
|||||||
request_mock = mocker.patch("ahriman.core.upload.github.Github._request")
|
request_mock = mocker.patch("ahriman.core.upload.github.Github._request")
|
||||||
|
|
||||||
github.asset_upload(github_release, Path("/root/new.tar.xz"))
|
github.asset_upload(github_release, Path("/root/new.tar.xz"))
|
||||||
request_mock.assert_called_with("POST", "upload_url", params={"name": "new.tar.xz"},
|
request_mock.assert_called_once_with("POST", "upload_url", params={"name": "new.tar.xz"},
|
||||||
data=b"", headers={"Content-Type": "application/octet-stream"})
|
data=b"", headers={"Content-Type": "application/octet-stream"})
|
||||||
|
|
||||||
|
|
||||||
def test_get_local_files(github: Github, resource_path_root: Path, mocker: MockerFixture) -> None:
|
def test_get_local_files(github: Github, resource_path_root: Path, mocker: MockerFixture) -> None:
|
||||||
|
@ -37,7 +37,7 @@ async def test_permits(authorization_policy: AuthorizationPolicy, user: User) ->
|
|||||||
authorization_policy.validator.verify_access.side_effect = lambda username, *args: username == user.username
|
authorization_policy.validator.verify_access.side_effect = lambda username, *args: username == user.username
|
||||||
|
|
||||||
assert await authorization_policy.permits(_identity(user.username), user.access, "/endpoint")
|
assert await authorization_policy.permits(_identity(user.username), user.access, "/endpoint")
|
||||||
authorization_policy.validator.verify_access.assert_called_with(user.username, user.access, "/endpoint")
|
authorization_policy.validator.verify_access.assert_called_once_with(user.username, user.access, "/endpoint")
|
||||||
|
|
||||||
assert not await authorization_policy.permits(_identity("somerandomname"), user.access, "/endpoint")
|
assert not await authorization_policy.permits(_identity("somerandomname"), user.access, "/endpoint")
|
||||||
assert not await authorization_policy.permits(user.username, user.access, "/endpoint")
|
assert not await authorization_policy.permits(user.username, user.access, "/endpoint")
|
||||||
@ -54,7 +54,7 @@ async def test_auth_handler_api(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
handler = auth_handler()
|
handler = auth_handler()
|
||||||
await handler(aiohttp_request, request_handler)
|
await handler(aiohttp_request, request_handler)
|
||||||
check_permission_mock.assert_called_with(aiohttp_request, UserAccess.Read, aiohttp_request.path)
|
check_permission_mock.assert_called_once_with(aiohttp_request, UserAccess.Read, aiohttp_request.path)
|
||||||
|
|
||||||
|
|
||||||
async def test_auth_handler_api_no_method(mocker: MockerFixture) -> None:
|
async def test_auth_handler_api_no_method(mocker: MockerFixture) -> None:
|
||||||
@ -68,7 +68,7 @@ async def test_auth_handler_api_no_method(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
handler = auth_handler()
|
handler = auth_handler()
|
||||||
await handler(aiohttp_request, request_handler)
|
await handler(aiohttp_request, request_handler)
|
||||||
check_permission_mock.assert_called_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
check_permission_mock.assert_called_once_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
||||||
|
|
||||||
|
|
||||||
async def test_auth_handler_api_post(mocker: MockerFixture) -> None:
|
async def test_auth_handler_api_post(mocker: MockerFixture) -> None:
|
||||||
@ -82,7 +82,7 @@ async def test_auth_handler_api_post(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
handler = auth_handler()
|
handler = auth_handler()
|
||||||
await handler(aiohttp_request, request_handler)
|
await handler(aiohttp_request, request_handler)
|
||||||
check_permission_mock.assert_called_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
check_permission_mock.assert_called_once_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
||||||
|
|
||||||
|
|
||||||
async def test_auth_handler_read(mocker: MockerFixture) -> None:
|
async def test_auth_handler_read(mocker: MockerFixture) -> None:
|
||||||
@ -97,7 +97,7 @@ async def test_auth_handler_read(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
handler = auth_handler()
|
handler = auth_handler()
|
||||||
await handler(aiohttp_request, request_handler)
|
await handler(aiohttp_request, request_handler)
|
||||||
check_permission_mock.assert_called_with(aiohttp_request, UserAccess.Read, aiohttp_request.path)
|
check_permission_mock.assert_called_once_with(aiohttp_request, UserAccess.Read, aiohttp_request.path)
|
||||||
|
|
||||||
|
|
||||||
async def test_auth_handler_write(mocker: MockerFixture) -> None:
|
async def test_auth_handler_write(mocker: MockerFixture) -> None:
|
||||||
@ -112,7 +112,7 @@ async def test_auth_handler_write(mocker: MockerFixture) -> None:
|
|||||||
|
|
||||||
handler = auth_handler()
|
handler = auth_handler()
|
||||||
await handler(aiohttp_request, request_handler)
|
await handler(aiohttp_request, request_handler)
|
||||||
check_permission_mock.assert_called_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
check_permission_mock.assert_called_once_with(aiohttp_request, UserAccess.Write, aiohttp_request.path)
|
||||||
|
|
||||||
|
|
||||||
def test_setup_auth(application_with_auth: web.Application, auth: Auth, mocker: MockerFixture) -> None:
|
def test_setup_auth(application_with_auth: web.Application, auth: Auth, mocker: MockerFixture) -> None:
|
||||||
|
@ -39,8 +39,8 @@ def test_run(application: web.Application, mocker: MockerFixture) -> None:
|
|||||||
run_application_mock = mocker.patch("aiohttp.web.run_app")
|
run_application_mock = mocker.patch("aiohttp.web.run_app")
|
||||||
|
|
||||||
run_server(application)
|
run_server(application)
|
||||||
run_application_mock.assert_called_with(application, host="127.0.0.1", port=port,
|
run_application_mock.assert_called_once_with(application, host="127.0.0.1", port=port,
|
||||||
handle_signals=False, access_log=pytest.helpers.anyvar(int))
|
handle_signals=False, access_log=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_run_with_auth(application_with_auth: web.Application, mocker: MockerFixture) -> None:
|
def test_run_with_auth(application_with_auth: web.Application, mocker: MockerFixture) -> None:
|
||||||
@ -52,8 +52,8 @@ def test_run_with_auth(application_with_auth: web.Application, mocker: MockerFix
|
|||||||
run_application_mock = mocker.patch("aiohttp.web.run_app")
|
run_application_mock = mocker.patch("aiohttp.web.run_app")
|
||||||
|
|
||||||
run_server(application_with_auth)
|
run_server(application_with_auth)
|
||||||
run_application_mock.assert_called_with(application_with_auth, host="127.0.0.1", port=port,
|
run_application_mock.assert_called_once_with(application_with_auth, host="127.0.0.1", port=port,
|
||||||
handle_signals=False, access_log=pytest.helpers.anyvar(int))
|
handle_signals=False, access_log=pytest.helpers.anyvar(int))
|
||||||
|
|
||||||
|
|
||||||
def test_run_with_debug(application_with_debug: web.Application, mocker: MockerFixture) -> None:
|
def test_run_with_debug(application_with_debug: web.Application, mocker: MockerFixture) -> None:
|
||||||
@ -65,5 +65,5 @@ def test_run_with_debug(application_with_debug: web.Application, mocker: MockerF
|
|||||||
run_application_mock = mocker.patch("aiohttp.web.run_app")
|
run_application_mock = mocker.patch("aiohttp.web.run_app")
|
||||||
|
|
||||||
run_server(application_with_debug)
|
run_server(application_with_debug)
|
||||||
run_application_mock.assert_called_with(application_with_debug, host="127.0.0.1", port=port,
|
run_application_mock.assert_called_once_with(application_with_debug, host="127.0.0.1", port=port,
|
||||||
handle_signals=False, access_log=pytest.helpers.anyvar(int))
|
handle_signals=False, access_log=pytest.helpers.anyvar(int))
|
||||||
|
@ -24,7 +24,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
|
|||||||
response = await client.post("/service-api/v1/add", json={"packages": ["ahriman"]})
|
response = await client.post("/service-api/v1/add", json={"packages": ["ahriman"]})
|
||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
add_mock.assert_called_with(["ahriman"], now=True)
|
add_mock.assert_called_once_with(["ahriman"], now=True)
|
||||||
|
|
||||||
|
|
||||||
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
||||||
@ -46,4 +46,4 @@ async def test_post_update(client: TestClient, mocker: MockerFixture) -> None:
|
|||||||
response = await client.post("/service-api/v1/update", json={"packages": ["ahriman"]})
|
response = await client.post("/service-api/v1/update", json={"packages": ["ahriman"]})
|
||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
add_mock.assert_called_with(["ahriman"], now=True)
|
add_mock.assert_called_once_with(["ahriman"], now=True)
|
||||||
|
@ -27,7 +27,7 @@ async def test_post(client_with_auth: TestClient, mocker: MockerFixture) -> None
|
|||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
reload_mock.assert_called_once()
|
reload_mock.assert_called_once()
|
||||||
load_mock.assert_called_with(client_with_auth.app["configuration"])
|
load_mock.assert_called_once_with(client_with_auth.app["configuration"])
|
||||||
|
|
||||||
|
|
||||||
async def test_post_no_auth(client: TestClient, mocker: MockerFixture) -> None:
|
async def test_post_no_auth(client: TestClient, mocker: MockerFixture) -> None:
|
||||||
|
@ -24,7 +24,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
|
|||||||
response = await client.post("/service-api/v1/remove", json={"packages": ["ahriman"]})
|
response = await client.post("/service-api/v1/remove", json={"packages": ["ahriman"]})
|
||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
remove_mock.assert_called_with(["ahriman"])
|
remove_mock.assert_called_once_with(["ahriman"])
|
||||||
|
|
||||||
|
|
||||||
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
||||||
|
@ -24,7 +24,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
|
|||||||
response = await client.post("/service-api/v1/request", json={"packages": ["ahriman"]})
|
response = await client.post("/service-api/v1/request", json={"packages": ["ahriman"]})
|
||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
add_mock.assert_called_with(["ahriman"], now=False)
|
add_mock.assert_called_once_with(["ahriman"], now=False)
|
||||||
|
|
||||||
|
|
||||||
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
||||||
|
@ -48,7 +48,7 @@ async def test_get_join(client: TestClient, mocker: MockerFixture) -> None:
|
|||||||
response = await client.get("/service-api/v1/search", params=[("for", "ahriman"), ("for", "maybe")])
|
response = await client.get("/service-api/v1/search", params=[("for", "ahriman"), ("for", "maybe")])
|
||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
search_mock.assert_called_with("ahriman maybe")
|
search_mock.assert_called_once_with("ahriman maybe")
|
||||||
|
|
||||||
|
|
||||||
async def test_get_join_filter(client: TestClient, mocker: MockerFixture) -> None:
|
async def test_get_join_filter(client: TestClient, mocker: MockerFixture) -> None:
|
||||||
@ -59,7 +59,7 @@ async def test_get_join_filter(client: TestClient, mocker: MockerFixture) -> Non
|
|||||||
response = await client.get("/service-api/v1/search", params=[("for", "ah"), ("for", "maybe")])
|
response = await client.get("/service-api/v1/search", params=[("for", "ah"), ("for", "maybe")])
|
||||||
|
|
||||||
assert response.ok
|
assert response.ok
|
||||||
search_mock.assert_called_with("maybe")
|
search_mock.assert_called_once_with("maybe")
|
||||||
|
|
||||||
|
|
||||||
async def test_get_join_filter_empty(client: TestClient, mocker: MockerFixture) -> None:
|
async def test_get_join_filter_empty(client: TestClient, mocker: MockerFixture) -> None:
|
||||||
|
@ -64,8 +64,8 @@ async def test_get(client_with_auth: TestClient, mocker: MockerFixture) -> None:
|
|||||||
get_response = await client_with_auth.get("/user-api/v1/login", params={"code": "code"})
|
get_response = await client_with_auth.get("/user-api/v1/login", params={"code": "code"})
|
||||||
|
|
||||||
assert get_response.ok
|
assert get_response.ok
|
||||||
oauth.get_oauth_username.assert_called_with("code")
|
oauth.get_oauth_username.assert_called_once_with("code")
|
||||||
oauth.known_username.assert_called_with("user")
|
oauth.known_username.assert_called_once_with("user")
|
||||||
remember_mock.assert_called_once()
|
remember_mock.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user