Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/api/views/test_stat.py
# Copyright (C) 2015-2019 The Software Heritage developers | # Copyright (C) 2015-2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from swh.storage.exc import StorageAPIError, StorageDBError | from swh.storage.exc import StorageAPIError, StorageDBError | ||||
from swh.web.common.exc import BadInputExc | from swh.web.common.exc import BadInputExc | ||||
from swh.web.common.utils import reverse | from swh.web.common.utils import reverse | ||||
from swh.web.tests.api.views import check_api_get_responses | from swh.web.tests.utils import check_api_get_responses | ||||
def test_api_1_stat_counters_raise_error(api_client, mocker): | def test_api_1_stat_counters_raise_error(api_client, mocker): | ||||
mock_archive = mocker.patch("swh.web.api.views.stat.archive") | mock_archive = mocker.patch("swh.web.api.views.stat.archive") | ||||
mock_archive.stat_counters.side_effect = BadInputExc( | mock_archive.stat_counters.side_effect = BadInputExc( | ||||
"voluntary error to check the bad request middleware." | "voluntary error to check the bad request middleware." | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |