fix: correct url for update requests in remote-call trigger

This commit is contained in:
Evgenii Alekseev 2023-12-11 15:43:28 +02:00
parent 2a9eab5f1a
commit e61b246216
2 changed files with 4 additions and 4 deletions

View File

@ -81,7 +81,7 @@ class RemoteCall(Report):
bool: True in case if remote process is alive and False otherwise bool: True in case if remote process is alive and False otherwise
""" """
try: try:
response = self.client.make_request("GET", f"/api/v1/service/process/{process_id}") response = self.client.make_request("GET", f"{self.client.address}/api/v1/service/process/{process_id}")
except requests.HTTPError as ex: except requests.HTTPError as ex:
status_code = ex.response.status_code if ex.response is not None else None status_code = ex.response.status_code if ex.response is not None else None
if status_code == 404: if status_code == 404:
@ -100,7 +100,7 @@ class RemoteCall(Report):
Returns: Returns:
str: remote process id str: remote process id
""" """
response = self.client.make_request("POST", "/api/v1/service/update", response = self.client.make_request("POST", f"{self.client.address}/api/v1/service/update",
params=self.repository_id.query(), params=self.repository_id.query(),
json={ json={
"aur": self.update_aur, "aur": self.update_aur,

View File

@ -30,7 +30,7 @@ def test_is_process_alive(remote_call: RemoteCall, mocker: MockerFixture) -> Non
request_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request", return_value=response_obj) request_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request", return_value=response_obj)
assert remote_call.is_process_alive("id") assert remote_call.is_process_alive("id")
request_mock.assert_called_once_with("GET", "/api/v1/service/process/id") request_mock.assert_called_once_with("GET", f"{remote_call.client.address}/api/v1/service/process/id")
def test_is_process_alive_unknown(remote_call: RemoteCall, mocker: MockerFixture) -> None: def test_is_process_alive_unknown(remote_call: RemoteCall, mocker: MockerFixture) -> None:
@ -79,7 +79,7 @@ def test_remote_update(remote_call: RemoteCall, mocker: MockerFixture) -> None:
request_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request", return_value=response_obj) request_mock = mocker.patch("ahriman.core.status.web_client.WebClient.make_request", return_value=response_obj)
assert remote_call.remote_update() == "id" assert remote_call.remote_update() == "id"
request_mock.assert_called_once_with("POST", "/api/v1/service/update", request_mock.assert_called_once_with("POST", f"{remote_call.client.address}/api/v1/service/update",
params=remote_call.repository_id.query(), params=remote_call.repository_id.query(),
json={ json={
"aur": False, "aur": False,