8
8
9
9
def test__get_project_for_url_or_path (mocker ):
10
10
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 )
12
12
openapi = mocker .MagicMock ()
13
13
from_dict = mocker .patch ("openapi_python_client.parser.GeneratorData.from_dict" , return_value = openapi )
14
14
_Project = mocker .patch ("openapi_python_client._Project" )
@@ -19,7 +19,7 @@ def test__get_project_for_url_or_path(mocker):
19
19
20
20
project = _get_project_for_url_or_path (url = url , path = path )
21
21
22
- _get_json .assert_called_once_with (url = url , path = path )
22
+ _get_document .assert_called_once_with (url = url , path = path )
23
23
from_dict .assert_called_once_with (data_dict )
24
24
_Project .assert_called_once_with (openapi = openapi )
25
25
assert project == _Project ()
@@ -58,56 +58,56 @@ def test_update_existing_client(mocker):
58
58
59
59
60
60
class TestGetJson :
61
- def test__get_json_no_url_or_path (self , mocker ):
61
+ def test__get_document_no_url_or_path (self , mocker ):
62
62
get = mocker .patch ("httpx.get" )
63
63
Path = mocker .patch ("openapi_python_client.Path" )
64
- loads = mocker .patch ("json.loads " )
64
+ loads = mocker .patch ("yaml.safe_load " )
65
65
66
- from openapi_python_client import _get_json
66
+ from openapi_python_client import _get_document
67
67
68
68
with pytest .raises (ValueError ):
69
- _get_json (url = None , path = None )
69
+ _get_document (url = None , path = None )
70
70
71
71
get .assert_not_called ()
72
72
Path .assert_not_called ()
73
73
loads .assert_not_called ()
74
74
75
- def test__get_json_url_and_path (self , mocker ):
75
+ def test__get_document_url_and_path (self , mocker ):
76
76
get = mocker .patch ("httpx.get" )
77
77
Path = mocker .patch ("openapi_python_client.Path" )
78
- loads = mocker .patch ("json.loads " )
78
+ loads = mocker .patch ("yaml.safe_load " )
79
79
80
- from openapi_python_client import _get_json
80
+ from openapi_python_client import _get_document
81
81
82
82
with pytest .raises (ValueError ):
83
- _get_json (url = mocker .MagicMock (), path = mocker .MagicMock ())
83
+ _get_document (url = mocker .MagicMock (), path = mocker .MagicMock ())
84
84
85
85
get .assert_not_called ()
86
86
Path .assert_not_called ()
87
87
loads .assert_not_called ()
88
88
89
- def test__get_json_url_no_path (self , mocker ):
89
+ def test__get_document_url_no_path (self , mocker ):
90
90
get = mocker .patch ("httpx.get" )
91
91
Path = mocker .patch ("openapi_python_client.Path" )
92
- loads = mocker .patch ("json.loads " )
92
+ loads = mocker .patch ("yaml.safe_load " )
93
93
94
- from openapi_python_client import _get_json
94
+ from openapi_python_client import _get_document
95
95
96
96
url = mocker .MagicMock ()
97
- _get_json (url = url , path = None )
97
+ _get_document (url = url , path = None )
98
98
99
99
get .assert_called_once_with (url )
100
100
Path .assert_not_called ()
101
101
loads .assert_called_once_with (get ().content )
102
102
103
- def test__get_json_path_no_url (self , mocker ):
103
+ def test__get_document_path_no_url (self , mocker ):
104
104
get = mocker .patch ("httpx.get" )
105
- loads = mocker .patch ("json.loads " )
105
+ loads = mocker .patch ("yaml.safe_load " )
106
106
107
- from openapi_python_client import _get_json
107
+ from openapi_python_client import _get_document
108
108
109
109
path = mocker .MagicMock ()
110
- _get_json (url = None , path = path )
110
+ _get_document (url = None , path = path )
111
111
112
112
get .assert_not_called ()
113
113
path .read_bytes .assert_called_once ()
0 commit comments