Skip to content

Commit 13fc020

Browse files
authored
Merge branch 'main' into ICNMLSALESSERVICESWDF2-3549-Move-DAR-SDK-from-Travis-CI-to-Github-actions
2 parents 32c4500 + 4f1e9bc commit 13fc020

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/sap/aibus/dar/client/test_dar_ai_api_file_upload_client.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,24 @@ def test_get_file_from_url_not_found(self, mock_send):
336336
"possible-solution-here."
337337
)
338338
mock_send.assert_called_once_with("GET", url)
339+
340+
@patch("requests.Session.send")
341+
def test_send_get_request_success(self, mock_send):
342+
"""Test _send method with a successful GET request."""
343+
344+
client = DARAIAPIFileUploadClient(
345+
base_url=self.base_url, get_token=self.get_mock_token
346+
)
347+
mock_response = MagicMock(spec=Response)
348+
mock_response.status_code = 200
349+
mock_response.text = "Success"
350+
mock_response.json.return_value = {"message": "Success"}
351+
mock_send.return_value = mock_response
352+
353+
url = self.base_url + "/files/local-dev/arxiv.csv.gz"
354+
response = client._send("GET", url)
355+
356+
assert response.status_code == 200
357+
assert response.json() == {"message": "Success"}
358+
359+
mock_send.assert_called_once()

0 commit comments

Comments
 (0)