"""Unit testcases for request methods.""" import httpx from owsclient.test import OwsClientMock from generate_flowthrough_adjustments.connectors import requests def test_get(ows_client_mock: OwsClientMock) -> None: """Test GET method.""" path = '/object/object_id' service = 'ows-service' options = {'timeout': 3} ows_client_mock.get( service, path, ).mock(return_value=httpx.Response(200, json={})) actual = requests.get(service, path, **options) assert actual.status_code == 200 assert actual.json() == {} def test_put(ows_client_mock: OwsClientMock): """Test PUT method.""" body = {'target_id': 666} path = '/object/object_id' service = 'ows-service' options = {'headers': {'foo': 'bar'}} ows_client_mock.put(service_name=service, path=path, json=body, **options).mock( return_value=httpx.Response(200, json={}) ) actual = requests.put(service=service, path=path, body=body, **options) assert actual.status_code == 200 assert actual.json() == {}