|
| 1 | +from . import integ_test_base |
| 2 | +import os |
| 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 | + # Uncomment the following line to preserve |
| 32 | + # test case output and other files (config, state, ect.) |
| 33 | + # in system temp folder. |
| 34 | + # self.set_delete_temp_folder(False) |
| 35 | + log_contents = self._get_log_contents() |
| 36 | + self.assertIn("Unrecognized value for TABPY_MINIMUM_TLS_VERSION", log_contents) |
| 37 | + self.assertIn("Setting minimum TLS version to TLSv1_2", log_contents) |
0 commit comments