requests_mock = <requests_mock.mocker.Mocker object at 0x7fbee0fabd30>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fbee0fab588>
mocked_time = None, origin_info = ('svn', 'mock://fake-origin-url/8')
def test_save_code_now_pending_state_unsupported(
requests_mock, mocker, mocked_time, origin_info
):
"""Pending save requests are not supported in the test so they should fail early
Pending requests are requests that need a moderator to accept the repository into
the save code now flow.
Do not actually use such origin to trigger the checks.
"""
scenario = WebScenario()
visit_type, origin = origin_info
root_api_url = "mock://swh-web2.example.org"
api_url = SaveCodeNowCheck.api_url_scn(root_api_url, origin, visit_type)
# creation request
scenario.add_step(
"post", api_url, fake_response(origin, visit_type, "pending", "not created"),
)
scenario.install_mock(requests_mock)
# fmt: off
result = invoke(
[
"check-savecodenow", "--swh-web-url", root_api_url,
"origin", origin,
"--visit-type", visit_type,
],
catch_exceptions=True,
)
# fmt: on
> assert result.output == (
f"{SaveCodeNowCheck.TYPE} CRITICAL - {REPORT_MSG} {origin_info} took "
f"0.00s and resulted in unsupported status: pending ; not created.\n"
f"| 'total_time' = 0.00s\n"
)
E assert '' == "SAVECODENOW ...me' = 0.00s\n"
E - SAVECODENOW CRITICAL - Save code now request for origin ('svn', 'mock://fake-origin-url/8') took 0.00s and resulted in unsupported status: pending ; not created.
E - | 'total_time' = 0.00s
.tox/py3/lib/python3.7/site-packages/swh/icinga_plugins/tests/test_save_code_now.py:171: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jan 12 2022, 3:17 PM