-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI (FreeBSD): Re-added tests which had been skipped by mistake
- Loading branch information
1 parent
2821e97
commit fb8e96a
Showing
5 changed files
with
50 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,27 +125,37 @@ def socket_pair(localhost_ip: str, tcp_socket_factory: Callable[[], Socket]) -> | |
|
||
|
||
@pytest.fixture(scope="session") | ||
def ssl_certificate_authority() -> trustme.CA: | ||
def ssl_certificate_authority() -> trustme.CA | None: | ||
try: | ||
import trustme | ||
except ModuleNotFoundError: | ||
pytest.skip("trustme is not installed") | ||
|
||
return trustme.CA() | ||
return None | ||
else: | ||
return trustme.CA() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def server_certificate(ssl_certificate_authority: trustme.CA) -> trustme.LeafCert: | ||
def server_certificate(ssl_certificate_authority: trustme.CA | None) -> trustme.LeafCert | None: | ||
if ssl_certificate_authority is None: | ||
return None | ||
return ssl_certificate_authority.issue_cert("*.example.com") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def client_certificate(ssl_certificate_authority: trustme.CA) -> trustme.LeafCert: | ||
def client_certificate(ssl_certificate_authority: trustme.CA | None) -> trustme.LeafCert | None: | ||
if ssl_certificate_authority is None: | ||
return None | ||
return ssl_certificate_authority.issue_cert("[email protected]") | ||
|
||
|
||
@pytest.fixture | ||
def server_ssl_context(ssl_certificate_authority: trustme.CA, server_certificate: trustme.LeafCert) -> ssl.SSLContext: | ||
def server_ssl_context( | ||
ssl_certificate_authority: trustme.CA | None, | ||
server_certificate: trustme.LeafCert | None, | ||
) -> ssl.SSLContext | None: | ||
if ssl_certificate_authority is None or server_certificate is None: | ||
return None | ||
|
||
server_ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) | ||
|
||
server_certificate.configure_cert(server_ssl_context) | ||
|
@@ -157,7 +167,13 @@ def server_ssl_context(ssl_certificate_authority: trustme.CA, server_certificate | |
|
||
|
||
@pytest.fixture | ||
def client_ssl_context(ssl_certificate_authority: trustme.CA, client_certificate: trustme.LeafCert) -> ssl.SSLContext: | ||
def client_ssl_context( | ||
ssl_certificate_authority: trustme.CA | None, | ||
client_certificate: trustme.LeafCert | None, | ||
) -> ssl.SSLContext | None: | ||
if ssl_certificate_authority is None or client_certificate is None: | ||
return None | ||
|
||
client_ssl_context = ssl.create_default_context() | ||
|
||
client_certificate.configure_cert(client_ssl_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
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