12
12
13
13
14
14
@pytest .fixture
15
- def terraform_releases_html_q_0_12 ():
15
+ def terraform_releases_html_after_v0_13_0 ():
16
16
return """
17
17
<!DOCTYPE html>
18
18
<html lang="en">
@@ -43,7 +43,7 @@ def terraform_releases_html_q_0_12():
43
43
# CacheControl at the same time as it also works at the Adapter level.
44
44
# - pook intercepts requests at a lower level by replacing urllib3.urlopen() by its
45
45
# own handler. This allows to actually verify what network requests would happen.
46
- # See See https://github.com/h2non/pook/blob/v1.0.2/pook/interceptors/urllib3.py#L24-L27
46
+ # See https://github.com/h2non/pook/blob/v1.0.2/pook/interceptors/urllib3.py#L24-L27
47
47
48
48
49
49
class AutoclosingBytesIO (io .BytesIO ):
@@ -74,19 +74,19 @@ def read(self, size=-1):
74
74
75
75
def test_search_on_github_cache_terraform_releases_200 (
76
76
tmp_working_dir ,
77
- terraform_releases_html_q_0_12 ,
77
+ terraform_releases_html_after_v0_13_0 ,
78
78
):
79
79
with mock .patch ("io.BytesIO" , AutoclosingBytesIO ):
80
80
with pook .use ():
81
81
repo = "hashicorp/terraform"
82
- releases_url = "https://github.com/{}/releases?q=0.12 " .format (repo )
82
+ releases_url = "https://github.com/{}/tags?after=v0.13.0 " .format (repo )
83
83
84
84
# A volatile mock that can only be invoked once
85
85
pook .get (
86
86
releases_url ,
87
87
reply = 200 ,
88
88
response_type = "text/plain" ,
89
- response_body = terraform_releases_html_q_0_12 ,
89
+ response_body = terraform_releases_html_after_v0_13_0 ,
90
90
response_headers = {
91
91
"Status" : "200 OK" ,
92
92
"ETag" : 'W/"df0474ebd25f223a95926ba58e11e77b"' ,
@@ -110,11 +110,13 @@ def test_search_on_github_cache_terraform_releases_200(
110
110
assert not pook .isactive ()
111
111
112
112
113
- def test_search_on_github_cache_terraform_releases_does_not_cache_error_429 (tmp_working_dir , terraform_releases_html_q_0_12 ):
113
+ def test_search_on_github_cache_terraform_releases_does_not_cache_error_429 (
114
+ tmp_working_dir , terraform_releases_html_after_v0_13_0
115
+ ):
114
116
with mock .patch ("io.BytesIO" , AutoclosingBytesIO ):
115
117
with pook .use ():
116
118
repo = "hashicorp/terraform"
117
- releases_url = "https://github.com/{}/releases?q=0.12 " .format (repo )
119
+ releases_url = "https://github.com/{}/tags?after=v0.13.0 " .format (repo )
118
120
119
121
# volatile mocks that can only be invoked once each
120
122
pook .get (
@@ -127,7 +129,7 @@ def test_search_on_github_cache_terraform_releases_does_not_cache_error_429(tmp_
127
129
releases_url ,
128
130
reply = 200 ,
129
131
response_type = "text/plain" ,
130
- response_body = terraform_releases_html_q_0_12 ,
132
+ response_body = terraform_releases_html_after_v0_13_0 ,
131
133
response_headers = {
132
134
"Status" : "200 OK" ,
133
135
"ETag" : 'W/"df0474ebd25f223a95926ba58e11e77b"' ,
@@ -157,12 +159,12 @@ def test_search_on_github_cache_terraform_releases_does_not_cache_error_429(tmp_
157
159
158
160
def test_search_on_github_cache_terraform_releases_does_not_cache_error_403 (
159
161
tmp_working_dir ,
160
- terraform_releases_html_q_0_12 ,
162
+ terraform_releases_html_after_v0_13_0 ,
161
163
):
162
164
with mock .patch ("io.BytesIO" , AutoclosingBytesIO ):
163
165
with pook .use ():
164
166
repo = "hashicorp/terraform"
165
- releases_url = "https://github.com/{}/releases?q=0.12 " .format (repo )
167
+ releases_url = "https://github.com/{}/tags?after=v0.13.0 " .format (repo )
166
168
167
169
# volatile mocks that can only be invoked once each
168
170
pook .get (
@@ -175,7 +177,7 @@ def test_search_on_github_cache_terraform_releases_does_not_cache_error_403(
175
177
releases_url ,
176
178
reply = 200 ,
177
179
response_type = "text/plain" ,
178
- response_body = terraform_releases_html_q_0_12 ,
180
+ response_body = terraform_releases_html_after_v0_13_0 ,
179
181
response_headers = {
180
182
"Status" : "200 OK" ,
181
183
"ETag" : 'W/"df0474ebd25f223a95926ba58e11e77b"' ,
@@ -205,12 +207,12 @@ def test_search_on_github_cache_terraform_releases_does_not_cache_error_403(
205
207
206
208
def test_search_on_github_cache_terraform_releases_does_not_cache_error_404 (
207
209
tmp_working_dir ,
208
- terraform_releases_html_q_0_12 ,
210
+ terraform_releases_html_after_v0_13_0 ,
209
211
):
210
212
with mock .patch ("io.BytesIO" , AutoclosingBytesIO ):
211
213
with pook .use ():
212
214
repo = "hashicorp/terraform"
213
- releases_url = "https://github.com/{}/releases?q=0.12 " .format (repo )
215
+ releases_url = "https://github.com/{}/tags?after=v0.13.0 " .format (repo )
214
216
215
217
# volatile mocks that can only be invoked once each
216
218
pook .get (
@@ -223,7 +225,7 @@ def test_search_on_github_cache_terraform_releases_does_not_cache_error_404(
223
225
releases_url ,
224
226
reply = 200 ,
225
227
response_type = "text/plain" ,
226
- response_body = terraform_releases_html_q_0_12 ,
228
+ response_body = terraform_releases_html_after_v0_13_0 ,
227
229
response_headers = {
228
230
"Status" : "200 OK" ,
229
231
"ETag" : 'W/"df0474ebd25f223a95926ba58e11e77b"' ,
0 commit comments