Skip to content

Commit

Permalink
Consolidate integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeichikawasalesforce committed Jun 19, 2024
1 parent 031de56 commit 2434b09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
from . import integ_test_base
import os
import requests


class TestMinimumTLSVersionInvalid(integ_test_base.IntegTestBase):
class TestMinimumTLSVersion(integ_test_base.IntegTestBase):
def _get_log_contents(self):
with open(self.log_file_path, 'r') as f:
return f.read()

def _get_config_file_name(self) -> str:
def _get_config_file_name(self, tls_version: str) -> str:
config_file = open(os.path.join(self.tmp_dir, "test.conf"), "w+")
config_file.write(
"[TabPy]\n"
"TABPY_PORT = 9005\n"
"TABPY_TRANSFER_PROTOCOL = https\n"
"TABPY_CERTIFICATE_FILE = ./tests/integration/resources/2019_04_24_to_3018_08_25.crt\n"
"TABPY_KEY_FILE = ./tests/integration/resources/2019_04_24_to_3018_08_25.key\n"
"TABPY_MINIMUM_TLS_VERSION = TLSv-1.3"
f"TABPY_MINIMUM_TLS_VERSION = {tls_version}"
)
pwd_file = self._get_pwd_file()
if pwd_file is not None:
Expand All @@ -27,7 +25,19 @@ def _get_config_file_name(self) -> str:
self.delete_config_file = True
return config_file.name

def test_minimum_tls_version_invalid(self):
class TestMinimumTLSVersionValid(TestMinimumTLSVersion):
def _get_config_file_name(self) -> str:
return super()._get_config_file_name("TLSv1_3")

def test_minimum_tls_version(self):
log_contents = self._get_log_contents()
self.assertIn("Setting minimum TLS version to TLSv1_3", log_contents)

class TestMinimumTLSVersionInvalid(TestMinimumTLSVersion):
def _get_config_file_name(self) -> str:
return super()._get_config_file_name("TLSv-1.3")

def test_minimum_tls_version(self):
log_contents = self._get_log_contents()
self.assertIn("Unrecognized value for TABPY_MINIMUM_TLS_VERSION", log_contents)
self.assertIn("Setting minimum TLS version to TLSv1_2", log_contents)
32 changes: 0 additions & 32 deletions tests/integration/test_minimum_tls_version_valid.py

This file was deleted.

0 comments on commit 2434b09

Please sign in to comment.