Skip to content

Commit de9dbe6

Browse files
committed
Set some things more simply
1 parent d81c7be commit de9dbe6

File tree

4 files changed

+10
-34
lines changed

4 files changed

+10
-34
lines changed

tests/mock_vws/test_authorization_header.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def test_missing(self, endpoint: TargetAPIEndpoint) -> None:
3737

3838
headers.pop('Authorization', None)
3939

40-
endpoint.prepared_request.prepare_headers( # type: ignore
41-
headers=headers,
42-
)
40+
endpoint.prepared_request.headers = headers
4341
session = requests.Session()
4442
response = session.send( # type: ignore
4543
request=endpoint.prepared_request,
@@ -64,9 +62,7 @@ def test_incorrect(self, endpoint: TargetAPIEndpoint) -> None:
6462
'Date': date,
6563
}
6664

67-
endpoint.prepared_request.prepare_headers( # type: ignore
68-
headers=headers,
69-
)
65+
endpoint.prepared_request.headers = headers
7066
session = requests.Session()
7167
response = session.send( # type: ignore
7268
request=endpoint.prepared_request,

tests/mock_vws/test_date_header.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ def test_no_date_header(
5252
'Authorization': authorization_string,
5353
}
5454
headers.pop('Date', None)
55-
56-
endpoint.prepared_request.prepare_headers( # type: ignore
57-
headers=headers,
58-
)
55+
endpoint.prepared_request.headers = headers
5956
session = requests.Session()
6057
response = session.send( # type: ignore
6158
request=endpoint.prepared_request,
@@ -107,9 +104,7 @@ def test_incorrect_date_format(
107104
'Date': date_incorrect_format,
108105
}
109106

110-
endpoint.prepared_request.prepare_headers( # type: ignore
111-
headers=headers,
112-
)
107+
endpoint.prepared_request.headers = headers
113108
session = requests.Session()
114109
response = session.send( # type: ignore
115110
request=endpoint.prepared_request,
@@ -171,9 +166,7 @@ def test_date_out_of_range(
171166
'Date': date,
172167
}
173168

174-
endpoint.prepared_request.prepare_headers( # type: ignore
175-
headers=headers,
176-
)
169+
endpoint.prepared_request.headers = headers
177170
session = requests.Session()
178171
response = session.send( # type: ignore
179172
request=endpoint.prepared_request,
@@ -227,9 +220,7 @@ def test_date_in_range(
227220
'Date': date,
228221
}
229222

230-
endpoint.prepared_request.prepare_headers( # type: ignore
231-
headers=headers,
232-
)
223+
endpoint.prepared_request.headers = headers
233224
session = requests.Session()
234225
response = session.send( # type: ignore
235226
request=endpoint.prepared_request,

tests/mock_vws/test_invalid_json.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,8 @@ def test_invalid_json(
6464
'Date': date,
6565
}
6666

67-
endpoint.prepared_request.prepare_body( # type: ignore
68-
data=content,
69-
files=None,
70-
)
71-
72-
endpoint.prepared_request.prepare_headers( # type: ignore
73-
headers=headers,
74-
)
67+
endpoint.prepared_request.body = content
68+
endpoint.prepared_request.headers = headers
7569
endpoint.prepared_request.prepare_content_length( # type: ignore
7670
body=content,
7771
)

tests/mock_vws/test_unexpected_json.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,8 @@ def test_does_not_take_data(
5656
'Content-Type': content_type,
5757
}
5858

59-
endpoint.prepared_request.prepare_body( # type: ignore
60-
data=content,
61-
files=None,
62-
)
63-
endpoint.prepared_request.prepare_headers( # type: ignore
64-
headers=headers,
65-
)
59+
endpoint.prepared_request.body = content
60+
endpoint.prepared_request.headers = headers
6661
endpoint.prepared_request.prepare_content_length( # type: ignore
6762
body=content,
6863
)

0 commit comments

Comments
 (0)