Make the MockTransport example more robust/correct (#1621)

This commit is contained in:
Vytautas Liuolia 2021-05-02 20:04:12 +02:00 committed by GitHub
parent 2129a9789a
commit 2e4b308d7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1100,7 +1100,7 @@ def handler(request):
# Switch to a mock transport, if the TESTING environment variable is set.
if os.environ['TESTING'].upper() == "TRUE":
if os.environ.get('TESTING', '').upper() == "TRUE":
transport = httpx.MockTransport(handler)
else:
transport = httpx.HTTPTransport()