88
99def test__get_project_for_url_or_path (mocker ):
1010 data_dict = mocker .MagicMock ()
11- _get_json = mocker .patch ("openapi_python_client._get_json " , return_value = data_dict )
11+ _get_document = mocker .patch ("openapi_python_client._get_document " , return_value = data_dict )
1212 openapi = mocker .MagicMock ()
1313 from_dict = mocker .patch ("openapi_python_client.parser.GeneratorData.from_dict" , return_value = openapi )
1414 _Project = mocker .patch ("openapi_python_client._Project" )
@@ -19,7 +19,7 @@ def test__get_project_for_url_or_path(mocker):
1919
2020 project = _get_project_for_url_or_path (url = url , path = path )
2121
22- _get_json .assert_called_once_with (url = url , path = path )
22+ _get_document .assert_called_once_with (url = url , path = path )
2323 from_dict .assert_called_once_with (data_dict )
2424 _Project .assert_called_once_with (openapi = openapi )
2525 assert project == _Project ()
@@ -58,56 +58,56 @@ def test_update_existing_client(mocker):
5858
5959
6060class TestGetJson :
61- def test__get_json_no_url_or_path (self , mocker ):
61+ def test__get_document_no_url_or_path (self , mocker ):
6262 get = mocker .patch ("httpx.get" )
6363 Path = mocker .patch ("openapi_python_client.Path" )
64- loads = mocker .patch ("json.loads " )
64+ loads = mocker .patch ("yaml.safe_load " )
6565
66- from openapi_python_client import _get_json
66+ from openapi_python_client import _get_document
6767
6868 with pytest .raises (ValueError ):
69- _get_json (url = None , path = None )
69+ _get_document (url = None , path = None )
7070
7171 get .assert_not_called ()
7272 Path .assert_not_called ()
7373 loads .assert_not_called ()
7474
75- def test__get_json_url_and_path (self , mocker ):
75+ def test__get_document_url_and_path (self , mocker ):
7676 get = mocker .patch ("httpx.get" )
7777 Path = mocker .patch ("openapi_python_client.Path" )
78- loads = mocker .patch ("json.loads " )
78+ loads = mocker .patch ("yaml.safe_load " )
7979
80- from openapi_python_client import _get_json
80+ from openapi_python_client import _get_document
8181
8282 with pytest .raises (ValueError ):
83- _get_json (url = mocker .MagicMock (), path = mocker .MagicMock ())
83+ _get_document (url = mocker .MagicMock (), path = mocker .MagicMock ())
8484
8585 get .assert_not_called ()
8686 Path .assert_not_called ()
8787 loads .assert_not_called ()
8888
89- def test__get_json_url_no_path (self , mocker ):
89+ def test__get_document_url_no_path (self , mocker ):
9090 get = mocker .patch ("httpx.get" )
9191 Path = mocker .patch ("openapi_python_client.Path" )
92- loads = mocker .patch ("json.loads " )
92+ loads = mocker .patch ("yaml.safe_load " )
9393
94- from openapi_python_client import _get_json
94+ from openapi_python_client import _get_document
9595
9696 url = mocker .MagicMock ()
97- _get_json (url = url , path = None )
97+ _get_document (url = url , path = None )
9898
9999 get .assert_called_once_with (url )
100100 Path .assert_not_called ()
101101 loads .assert_called_once_with (get ().content )
102102
103- def test__get_json_path_no_url (self , mocker ):
103+ def test__get_document_path_no_url (self , mocker ):
104104 get = mocker .patch ("httpx.get" )
105- loads = mocker .patch ("json.loads " )
105+ loads = mocker .patch ("yaml.safe_load " )
106106
107- from openapi_python_client import _get_json
107+ from openapi_python_client import _get_document
108108
109109 path = mocker .MagicMock ()
110- _get_json (url = None , path = path )
110+ _get_document (url = None , path = path )
111111
112112 get .assert_not_called ()
113113 path .read_bytes .assert_called_once ()
0 commit comments