From 971b5fc5875d6e6a5542ec4dc2debd462dfb8d4a Mon Sep 17 00:00:00 2001 From: Luis Presuel Date: Wed, 4 Dec 2024 16:36:01 -0600 Subject: [PATCH] fixes convention to use pytest style, as currently our tests runs on it rather than unittest.Testcase. To be noted that Pytest doesn't follow the same initialization mechanisms as unittest library --- tests/test_pm.py | 3 +-- tests/test_ssh.py | 3 +-- tests/test_tpp.py | 3 +-- tests/test_tpp_token.py | 3 +-- tests/test_vaas.py | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/test_pm.py b/tests/test_pm.py index e54b1ee..5bf37c2 100644 --- a/tests/test_pm.py +++ b/tests/test_pm.py @@ -40,8 +40,7 @@ class TestParsers(unittest.TestCase): - def __init__(self, *args, **kwargs): - super(TestParsers, self).__init__(*args, **kwargs) + def setUp(self): self.json_file = POLICY_SPEC_JSON self.yaml_file = POLICY_SPEC_YAML diff --git a/tests/test_ssh.py b/tests/test_ssh.py index d357541..0991f02 100644 --- a/tests/test_ssh.py +++ b/tests/test_ssh.py @@ -32,11 +32,10 @@ class TestTPPTokenSSHCertificate(unittest.TestCase): - def __init__(self, *args, **kwargs): + def setUp(self): self.tpp_conn = TPPTokenConnection(url=TPP_TOKEN_URL, http_request_kwargs={'verify': "/tmp/chain.pem"}) auth = Authentication(user=TPP_USER, password=TPP_PASSWORD, scope=SCOPE_SSH) self.tpp_conn.get_access_token(auth) - super(TestTPPTokenSSHCertificate, self).__init__(*args, **kwargs) def test_enroll_local_generated_keypair(self): keypair = SSHKeyPair() diff --git a/tests/test_tpp.py b/tests/test_tpp.py index 5ff888b..11ffc77 100644 --- a/tests/test_tpp.py +++ b/tests/test_tpp.py @@ -42,11 +42,10 @@ def test_fake_enroll(self): class TestTPPMethods(unittest.TestCase): - def __init__(self, *args, **kwargs): + def setUp(self): self.tpp_zone = TPP_ZONE self.tpp_zone_ecdsa = TPP_ZONE_ECDSA self.tpp_conn = TPPConnection(TPP_USER, TPP_PASSWORD, TPP_URL, http_request_kwargs={'verify': "/tmp/chain.pem"}) - super(TestTPPMethods, self).__init__(*args, **kwargs) def test_tpp_enroll(self): cn = f"{random_word(10)}.venafi.example.com" diff --git a/tests/test_tpp_token.py b/tests/test_tpp_token.py index 54b8b8c..d97aca0 100644 --- a/tests/test_tpp_token.py +++ b/tests/test_tpp_token.py @@ -34,12 +34,11 @@ class TestTPPTokenMethods(unittest.TestCase): - def __init__(self, *args, **kwargs): + def setUp(self): self.tpp_zone = TPP_ZONE self.tpp_zone_ecdsa = TPP_ZONE_ECDSA self.tpp_conn = TPPTokenConnection(url=TPP_TOKEN_URL, user=TPP_USER, password=TPP_PASSWORD, http_request_kwargs={'verify': "/tmp/chain.pem"}) - super(TestTPPTokenMethods, self).__init__(*args, **kwargs) def test_tpp_token_enroll(self): cn = f"{random_word(10)}.venafi.example.com" diff --git a/tests/test_vaas.py b/tests/test_vaas.py index 83422e6..39ca9a8 100644 --- a/tests/test_vaas.py +++ b/tests/test_vaas.py @@ -37,11 +37,10 @@ class TestVaaSMethods(unittest.TestCase): - def __init__(self, *args, **kwargs): + def setUp(self): self.cloud_zone = CLOUD_ZONE self.vaas_zone_ec = VAAS_ZONE_ONLY_EC self.cloud_conn = CloudConnection(token=CLOUD_APIKEY, url=CLOUD_URL) - super(TestVaaSMethods, self).__init__(*args, **kwargs) def test_cloud_enroll(self): cn = f"{random_word(10)}.venafi.example.com"