| @@ 6-37 (lines=32) @@ | ||
| 3 | import requests |
|
| 4 | ||
| 5 | ||
| 6 | class TestMinimumTLSVersionInvalid(integ_test_base.IntegTestBase): |
|
| 7 | def _get_log_contents(self): |
|
| 8 | with open(self.log_file_path, 'r') as f: |
|
| 9 | return f.read() |
|
| 10 | ||
| 11 | def _get_config_file_name(self) -> str: |
|
| 12 | config_file = open(os.path.join(self.tmp_dir, "test.conf"), "w+") |
|
| 13 | config_file.write( |
|
| 14 | "[TabPy]\n" |
|
| 15 | "TABPY_PORT = 9005\n" |
|
| 16 | "TABPY_TRANSFER_PROTOCOL = https\n" |
|
| 17 | "TABPY_CERTIFICATE_FILE = ./tests/integration/resources/2019_04_24_to_3018_08_25.crt\n" |
|
| 18 | "TABPY_KEY_FILE = ./tests/integration/resources/2019_04_24_to_3018_08_25.key\n" |
|
| 19 | "TABPY_MINIMUM_TLS_VERSION = TLSv-1.3" |
|
| 20 | ) |
|
| 21 | pwd_file = self._get_pwd_file() |
|
| 22 | if pwd_file is not None: |
|
| 23 | pwd_file = os.path.abspath(pwd_file) |
|
| 24 | config_file.write(f"TABPY_PWD_FILE = {pwd_file}\n") |
|
| 25 | ||
| 26 | config_file.close() |
|
| 27 | self.delete_config_file = True |
|
| 28 | return config_file.name |
|
| 29 | ||
| 30 | def test_minimum_tls_version_invalid(self): |
|
| 31 | log_contents = self._get_log_contents() |
|
| 32 | self.assertIn("Unrecognized value for TABPY_MINIMUM_TLS_VERSION", log_contents) |
|
| 33 | self.assertIn("Setting minimum TLS version to TLSv1_2", log_contents) |
|
| 34 | ||
| @@ 6-36 (lines=31) @@ | ||
| 3 | import requests |
|
| 4 | ||
| 5 | ||
| 6 | class TestMinimumTLSVersionValid(integ_test_base.IntegTestBase): |
|
| 7 | def _get_log_contents(self): |
|
| 8 | with open(self.log_file_path, 'r') as f: |
|
| 9 | return f.read() |
|
| 10 | ||
| 11 | def _get_config_file_name(self) -> str: |
|
| 12 | config_file = open(os.path.join(self.tmp_dir, "test.conf"), "w+") |
|
| 13 | config_file.write( |
|
| 14 | "[TabPy]\n" |
|
| 15 | "TABPY_PORT = 9005\n" |
|
| 16 | "TABPY_TRANSFER_PROTOCOL = https\n" |
|
| 17 | "TABPY_CERTIFICATE_FILE = ./tests/integration/resources/2019_04_24_to_3018_08_25.crt\n" |
|
| 18 | "TABPY_KEY_FILE = ./tests/integration/resources/2019_04_24_to_3018_08_25.key\n" |
|
| 19 | "TABPY_MINIMUM_TLS_VERSION = TLSv1_3" |
|
| 20 | ) |
|
| 21 | pwd_file = self._get_pwd_file() |
|
| 22 | if pwd_file is not None: |
|
| 23 | pwd_file = os.path.abspath(pwd_file) |
|
| 24 | config_file.write(f"TABPY_PWD_FILE = {pwd_file}\n") |
|
| 25 | ||
| 26 | config_file.close() |
|
| 27 | self.delete_config_file = True |
|
| 28 | return config_file.name |
|
| 29 | ||
| 30 | def test_minimum_tls_version_valid(self): |
|
| 31 | log_contents = self._get_log_contents() |
|
| 32 | self.assertIn("Setting minimum TLS version to TLSv1_3", log_contents) |
|
| 33 | ||