Skip to content

Commit a7ec3ba

Browse files
committed
test allow_redirects
1 parent 21d788c commit a7ec3ba

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/real_call_test.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,18 @@ def test_gets():
4242
adafruit_connection_manager.connection_manager_close_all(release_references=True)
4343

4444

45-
def test_http_to_https_redirect():
45+
@pytest.mark.parametrize(
46+
("allow_redirects", "status_code"),
47+
(
48+
(True, 200),
49+
(False, 301),
50+
),
51+
)
52+
def test_http_to_https_redirect(allow_redirects, status_code):
4653
url = "http://www.adafruit.com/api/quotes.php"
4754
requests = adafruit_requests.Session(socket, ssl.create_default_context())
48-
with requests.get(url) as response:
49-
assert response.status_code == 200
55+
with requests.get(url, allow_redirects=allow_redirects) as response:
56+
assert response.status_code == status_code
5057

5158

5259
def test_https_direct():

0 commit comments

Comments
 (0)