From e8a95e7fc03fb5c0bc304bb9918f188b94267387 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 27 Jan 2021 18:21:55 -0600 Subject: [PATCH] reformat test files with black and satisfy flake8 --- tests/test_action_delete.py | 1 + tests/test_action_get_policy.py | 2 +- tests/test_action_list_policies.py | 2 +- tests/test_action_read_kv.py | 1 - tests/test_action_set_policy.py | 9 +-------- tests/test_action_write.py | 1 + tests/vault_action_tests_base.py | 5 ----- 7 files changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/test_action_delete.py b/tests/test_action_delete.py index bbff2aa..01b0f83 100644 --- a/tests/test_action_delete.py +++ b/tests/test_action_delete.py @@ -13,6 +13,7 @@ def test_delete_existing_key(self): action = self.get_action_instance(config=self.dummy_pack_config) action_result = action.run(path="secret/stanley") # action_result is a requests.response object + assert action_result is not None result = self.client.read("secret/stanley") assert result is None diff --git a/tests/test_action_get_policy.py b/tests/test_action_get_policy.py index 43b6711..86039c1 100644 --- a/tests/test_action_get_policy.py +++ b/tests/test_action_get_policy.py @@ -7,7 +7,7 @@ class GetPolicyActionTestCase(VaultActionTestCase): def test_method(self): # setup - rules_text, rules_obj = self.prep_policy("stanley") + rules_text, _ = self.prep_policy("stanley") # test action = self.get_action_instance(config=self.dummy_pack_config) diff --git a/tests/test_action_list_policies.py b/tests/test_action_list_policies.py index f500ceb..2345e44 100644 --- a/tests/test_action_list_policies.py +++ b/tests/test_action_list_policies.py @@ -7,7 +7,7 @@ class PolicyListActionTestCase(VaultActionTestCase): def test_method(self): # setup - rules_text, rules_obj = self.prep_policy("stanley") + self.prep_policy("stanley") # test action = self.get_action_instance(config=self.dummy_pack_config) diff --git a/tests/test_action_read_kv.py b/tests/test_action_read_kv.py index 6603ed6..4b3a944 100644 --- a/tests/test_action_read_kv.py +++ b/tests/test_action_read_kv.py @@ -18,7 +18,6 @@ def test_read_kv1(self): mount_point=mount_point, ) - # test action = self.get_action_instance(config=self.dummy_pack_config) result = action.run( diff --git a/tests/test_action_set_policy.py b/tests/test_action_set_policy.py index b7b83e8..9f45046 100644 --- a/tests/test_action_set_policy.py +++ b/tests/test_action_set_policy.py @@ -11,14 +11,7 @@ def test_method(self): path "sys" { policy = "deny" } path "secret" { policy = "write" } """ - rules_obj = { - "path": { - "sys": { - "policy": "deny"}, - "secret": { - "policy": "write"} - } - } + # rules_obj = {"path": {"sys": {"policy": "deny"}, "secret": {"policy": "write"}}} action = self.get_action_instance(config=self.dummy_pack_config) action_result = action.run( diff --git a/tests/test_action_write.py b/tests/test_action_write.py index 804d98e..78bb406 100644 --- a/tests/test_action_write.py +++ b/tests/test_action_write.py @@ -13,6 +13,7 @@ def test_write_key(self): values='{"st2": "awesome"}', ) # action_result is a requests.response object + assert action_result is not None result = self.client.read("secret/stanley") assert result["data"]["st2"] == "awesome" diff --git a/tests/vault_action_tests_base.py b/tests/vault_action_tests_base.py index 077cecb..4724657 100644 --- a/tests/vault_action_tests_base.py +++ b/tests/vault_action_tests_base.py @@ -62,21 +62,16 @@ def build_dummy_pack_config(self, url="https://localhost:8200"): dummy_pack_config = { "url": url, - # pack config | relation | hvac.Client() # ------------|----------|-------------- # cert | != | cert # cert+verify | == | verify "cert": server_cert_path, "verify": True, - "auth_method": "token", - "token": token, - "role_id": None, "secret_id": None, } return dummy_pack_config -