Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SSL tests failing due to old weak MDs
Had to drop pytest-localserver, since it's broken and upstream is gone.
- Loading branch information
Hugo Osvaldo Barrera
committed
Jun 20, 2021
1 parent
59b6e24
commit 1f6cc6f
Showing
5 changed files
with
74 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
hypothesis>=5.0.0,<7.0.0 | ||
pytest | ||
pytest-cov | ||
pytest-localserver | ||
pytest-httpserver | ||
trustme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import ssl | ||
|
||
import pytest | ||
import trustme | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def ca(): | ||
return trustme.CA() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def localhost_cert(ca): | ||
return ca.issue_cert("localhost") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def httpserver_ssl_context(localhost_cert): | ||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) | ||
|
||
crt = localhost_cert.cert_chain_pems[0] | ||
key = localhost_cert.private_key_pem | ||
with crt.tempfile() as crt_file, key.tempfile() as key_file: | ||
context.load_cert_chain(crt_file, key_file) | ||
|
||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters