File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -1245,7 +1245,7 @@ def __init__(
12451245 kwargs = {}
12461246 if self ._verify_ssl_certs :
12471247 kwargs ["verify" ] = ssl .create_default_context (
1248- capath = stripe .ca_bundle_path
1248+ cafile = stripe .ca_bundle_path
12491249 )
12501250 else :
12511251 kwargs ["verify" ] = False
Original file line number Diff line number Diff line change 1+ import base64
12from typing import Any , List
23from typing_extensions import Type
34from unittest .mock import call
@@ -1971,3 +1972,33 @@ def test_timeout(self):
19711972
19721973 def test_timeout_async (self ):
19731974 pass
1975+
1976+
1977+ class TestLiveHTTPClients :
1978+ """
1979+ Tests that actually make HTTP requests in order to test functionality (like https)
1980+ end to end.
1981+ """
1982+
1983+ @pytest .mark .anyio
1984+ async def test_httpx_request_async_https (self ):
1985+ """
1986+ Test to ensure that httpx https calls succeed by making a live test call
1987+ to the public stripe API.
1988+ """
1989+ method = "get"
1990+ abs_url = "https://api.stripe.com/v1/balance"
1991+ data = {}
1992+
1993+ client = _http_client .HTTPXClient (verify_ssl_certs = True )
1994+ # the public test secret key, as found on https://docs.stripe.com/keys#obtain-api-keys
1995+ test_api_key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"
1996+ basic_auth = base64 .b64encode (
1997+ (test_api_key + ":" ).encode ("utf-8" )
1998+ ).decode ("utf-8" )
1999+ headers = {"Authorization" : "Basic " + basic_auth }
2000+
2001+ _ , code , _ = await client .request_with_retries_async (
2002+ method , abs_url , headers , data
2003+ )
2004+ assert code >= 200 and code < 400
You can’t perform that action at this time.
0 commit comments