|
20 | 20 |
|
21 | 21 |
|
22 | 22 | class TestSessionResumptionSupport:
|
23 |
| - def test(self) -> None: |
24 |
| - # Given a server that supports session resumption with both TLS tickets and session IDs |
25 |
| - server_location = ServerNetworkLocation("www.google.com", 443) |
26 |
| - server_info = check_connectivity_to_server_and_return_info(server_location) |
| 23 | + @can_only_run_on_linux_64 |
| 24 | + def test_resumption_with_session_ids(self) -> None: |
| 25 | + # Given a server that supports session resumption with session IDs |
| 26 | + with ModernOpenSslServer() as server: |
| 27 | + server_location = ServerNetworkLocation( |
| 28 | + hostname=server.hostname, ip_address=server.ip_address, port=server.port |
| 29 | + ) |
| 30 | + network_config = ServerNetworkConfiguration( |
| 31 | + tls_server_name_indication=server.hostname, |
| 32 | + ) |
| 33 | + server_info = check_connectivity_to_server_and_return_info(server_location, network_config) |
27 | 34 |
|
28 |
| - # When testing for resumption, it succeeds |
29 |
| - result: SessionResumptionSupportScanResult = SessionResumptionSupportImplementation.scan_server(server_info) |
| 35 | + # When testing for resumption, it succeeds |
| 36 | + result: SessionResumptionSupportScanResult = SessionResumptionSupportImplementation.scan_server(server_info) |
30 | 37 |
|
31 |
| - # And it confirms that both session IDs and TLS tickets are supported |
| 38 | + # And it confirms that resumption with session IDs is supported |
32 | 39 | assert result.session_id_resumption_result == TlsResumptionSupportEnum.FULLY_SUPPORTED
|
33 | 40 | assert result.session_id_attempted_resumptions_count
|
34 | 41 | assert result.session_id_successful_resumptions_count
|
35 | 42 |
|
| 43 | + # And a CLI output can be generated |
| 44 | + assert SessionResumptionSupportImplementation.cli_connector_cls.result_to_console_output(result) |
| 45 | + |
| 46 | + # And the result can be converted to JSON |
| 47 | + result_as_json = SessionResumptionSupportScanResultAsJson.model_validate(result).model_dump_json() |
| 48 | + assert result_as_json |
| 49 | + |
| 50 | + def test_resumption_with_tls_tickets(self) -> None: |
| 51 | + # Given a server that supports session resumption with TLS tickets |
| 52 | + server_location = ServerNetworkLocation("www.google.com", 443) |
| 53 | + server_info = check_connectivity_to_server_and_return_info(server_location) |
| 54 | + |
| 55 | + # When testing for resumption, it succeeds |
| 56 | + result: SessionResumptionSupportScanResult = SessionResumptionSupportImplementation.scan_server(server_info) |
| 57 | + |
| 58 | + # And it confirms that TLS tickets are supported |
36 | 59 | assert result.tls_ticket_resumption_result == TlsResumptionSupportEnum.FULLY_SUPPORTED
|
37 | 60 | assert result.tls_ticket_attempted_resumptions_count
|
38 | 61 | assert result.tls_ticket_successful_resumptions_count
|
|
0 commit comments