@@ -41,10 +41,10 @@ def test_convert_null_header_tuples_to_dict(self):
41
41
test_headers_list = None
42
42
expected_headers_dict = {}
43
43
44
- assert self .test_api_client ._convert_list_tuples_to_dict (
45
- test_headers_list ) == expected_headers_dict , (
44
+ self . assertEqual ( self .test_api_client ._convert_list_tuples_to_dict (
45
+ test_headers_list ), expected_headers_dict , (
46
46
"DefaultApiClient failed to convert null headers list to empty "
47
- "dict object" )
47
+ "dict object" ))
48
48
49
49
def test_convert_header_tuples_to_dict (self ):
50
50
test_headers_list = [
@@ -53,20 +53,20 @@ def test_convert_header_tuples_to_dict(self):
53
53
expected_headers_dict = {
54
54
"header_1" : "test_1, test_3" , "header_2" : "test_2" }
55
55
56
- assert self .test_api_client ._convert_list_tuples_to_dict (
57
- test_headers_list ) == expected_headers_dict , (
56
+ self . assertEqual ( self .test_api_client ._convert_list_tuples_to_dict (
57
+ test_headers_list ), expected_headers_dict , (
58
58
"DefaultApiClient failed to convert header list of tuples to "
59
59
"dictionary format needed for http "
60
- "request call" )
60
+ "request call" ))
61
61
62
62
def test_convert_null_header_dict_to_tuples (self ):
63
63
test_headers_dict = None
64
64
expected_headers_list = []
65
65
66
- assert self .test_api_client ._convert_dict_to_list_tuples (
67
- test_headers_dict ) == expected_headers_list , (
66
+ self . assertEqual ( self .test_api_client ._convert_dict_to_list_tuples (
67
+ test_headers_dict ), expected_headers_list , (
68
68
"DefaultApiClient failed to convert null headers dict to empty "
69
- "list object" )
69
+ "list object" ))
70
70
71
71
def test_convert_header_dict_to_tuples (self ):
72
72
test_headers_dict = {
@@ -76,11 +76,11 @@ def test_convert_header_dict_to_tuples(self):
76
76
("header_1" , "test_1" ), ("header_1" , "test_3" ),
77
77
("header_2" , "test_2" ), ("header_3" , "test_4" )]
78
78
79
- assert set (self .test_api_client ._convert_dict_to_list_tuples (
80
- test_headers_dict )) == set (
79
+ self . assertEqual ( set (self .test_api_client ._convert_dict_to_list_tuples (
80
+ test_headers_dict )), set (
81
81
expected_headers_list ), (
82
82
"DefaultApiClient failed to convert headers dict to list of "
83
- "tuples format for ApiClientResponse" )
83
+ "tuples format for ApiClientResponse" ))
84
84
85
85
def test_resolve_valid_http_method (self ):
86
86
with mock .patch ("requests.get" ,
@@ -104,15 +104,15 @@ def test_resolve_invalid_http_method_throw_exception(self):
104
104
with self .assertRaises (ApiClientException ) as exc :
105
105
self .test_api_client .invoke (test_invalid_method_request )
106
106
107
- assert "Invalid request method: GET_TEST" in str (exc .exception )
107
+ self . assertIn ( "Invalid request method: GET_TEST" , str (exc .exception ) )
108
108
109
109
def test_invoke_http_method_throw_exception (self ):
110
110
with mock .patch ("requests.get" ,
111
111
side_effect = Exception ("test exception" )):
112
112
with self .assertRaises (ApiClientException ) as exc :
113
113
self .test_api_client .invoke (self .valid_request )
114
114
115
- assert "Error executing the request: test exception" in str (exc .exception )
115
+ self . assertIn ( "Error executing the request: test exception" , str (exc .exception ) )
116
116
117
117
def test_api_client_invoke_with_method_headers_processed (self ):
118
118
self .valid_request .headers = [
@@ -131,21 +131,21 @@ def test_api_client_invoke_with_method_headers_processed(self):
131
131
side_effect = lambda * args , ** kwargs : test_response ):
132
132
actual_response = self .test_api_client .invoke (self .valid_request )
133
133
134
- assert set (actual_response .headers ) == set ([
134
+ self . assertEqual ( set (actual_response .headers ), set ([
135
135
("response_header_1" , "test_1" ),
136
136
("response_header_1" , "test_3" ),
137
137
("response_header_2" , "test_2" ),
138
138
("response_header_3" , "test_4" )]), (
139
139
"Response headers from client doesn't match with the "
140
- "expected headers" )
140
+ "expected headers" ))
141
141
142
- assert actual_response .status_code == 400 , (
142
+ self . assertEqual ( actual_response .status_code , 400 , (
143
143
"Status code from client response doesn't match with the "
144
- "expected response status code" )
144
+ "expected response status code" ))
145
145
146
- assert actual_response .body == "test response body" , (
146
+ self . assertEqual ( actual_response .body , "test response body" , (
147
147
"Body from client response doesn't match with the expected "
148
- "response body" )
148
+ "response body" ))
149
149
150
150
def test_api_client_invoke_with_http_url_throw_error (self ):
151
151
test_invalid_url_scheme_request = ApiClientRequest (
@@ -157,7 +157,7 @@ def test_api_client_invoke_with_http_url_throw_error(self):
157
157
with self .assertRaises (ApiClientException ) as exc :
158
158
self .test_api_client .invoke (test_invalid_url_scheme_request )
159
159
160
- assert "Requests against non-HTTPS endpoints are not allowed." in str (exc .exception )
160
+ self . assertIn ( "Requests against non-HTTPS endpoints are not allowed." , str (exc .exception ) )
161
161
162
162
def test_api_client_invoke_with_http_case_sensitive_url_throw_error (self ):
163
163
test_invalid_url_scheme_request = ApiClientRequest (
@@ -169,7 +169,7 @@ def test_api_client_invoke_with_http_case_sensitive_url_throw_error(self):
169
169
with self .assertRaises (ApiClientException ) as exc :
170
170
self .test_api_client .invoke (test_invalid_url_scheme_request )
171
171
172
- assert "Requests against non-HTTPS endpoints are not allowed." in str (exc .exception )
172
+ self . assertIn ( "Requests against non-HTTPS endpoints are not allowed." , str (exc .exception ) )
173
173
174
174
def test_api_client_invoke_with_no_url_schema_throw_error (self ):
175
175
test_invalid_url_scheme_request = ApiClientRequest (
@@ -181,7 +181,7 @@ def test_api_client_invoke_with_no_url_schema_throw_error(self):
181
181
with self .assertRaises (ApiClientException ) as exc :
182
182
self .test_api_client .invoke (test_invalid_url_scheme_request )
183
183
184
- assert "Requests against non-HTTPS endpoints are not allowed." in str (exc .exception )
184
+ self . assertIn ( "Requests against non-HTTPS endpoints are not allowed." , str (exc .exception ) )
185
185
186
186
def test_api_client_send_request_with_raw_data_serialized_for_json_content (
187
187
self ):
0 commit comments