Exemple #1
0
def test_add_failed_http_error(web_client: WebClient, package_ahriman: Package,
                               mocker: MockerFixture) -> None:
    """
    must suppress any exception happened during addition
    """
    mocker.patch("requests.post", side_effect=requests.exceptions.HTTPError())
    web_client.add(package_ahriman, BuildStatusEnum.Unknown)
Exemple #2
0
def test_add(web_client: WebClient, package_ahriman: Package,
             mocker: MockerFixture) -> None:
    """
    must process package addition
    """
    requests_mock = mocker.patch("requests.post")
    payload = pytest.helpers.get_package_status(package_ahriman)

    web_client.add(package_ahriman, BuildStatusEnum.Unknown)
    requests_mock.assert_called_with(pytest.helpers.anyvar(str, True),
                                     json=payload)