Repository: chaostoolkit/chaostoolkit-lib (language: python)

Issue:
Secrets testing taking advantage of side effect
**Is your feature request related to a problem? Please describe.**
I'm trying to understand the project enough to address #209 , and noticed that in the test_secret.py file, in some functions you were specifying at the top     
```
os.environ["KUBE_API_URL"] = "http://1.2.3.4"
```

and in others you weren't, but you're checking in multiple places where you weren't doing the assignment at the top that KUBE_API_URL resolves to "http://1.2.3.4".  Some of the testcases, like test_should_load_inline and test_should_merge_properly are working due to os.environ being a global namespace, and so the declare in test_should_load_environment applying to all the later testcases.  

**Describe the solution you'd like**

I'd prefer not to use a side-effect in testcases.  So I'd prefer to replace the os.environ statements at the beginning of some of the testcases with 
```@patch.dict(os.environ, {"KUBE_API_URL": "http://1.2.3.4"})```


**Describe alternatives you've considered**

Other options would be to put 
```os.environ["KUBE_API_URL"] = "http://1.2.3.4"```
at the beginning of all the testcases, so it's at least clear where that's coming from, or remove it from all but the first.  But both of those are potentially confusing in different ways.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1bfe158..bfa5efa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
 * Update CI builds to build, lint, and test
 * Allow nesting of secrets
 * Secrets loaded from a vault can be overridden by variables
+* In secrets testcases, change the os.environ to be a patch, not an assignment within the testcase.
 
 ### Added
 


Test patch:
diff --git a/tests/test_secret.py b/tests/test_secret.py
index 39b1765..1b4156a 100644
--- a/tests/test_secret.py
+++ b/tests/test_secret.py
@@ -10,8 +10,8 @@
 from chaoslib.secret import create_vault_client, load_secrets
 
 
+@patch.dict(os.environ, {"KUBE_API_URL": "http://1.2.3.4"})
 def test_should_load_environment():
-    os.environ["KUBE_API_URL"] = "http://1.2.3.4"
     secrets = load_secrets(
         {"kubernetes": {"api_server_url": {"type": "env", "key": "KUBE_API_URL"}}},
         config.EmptyConfig,
@@ -46,6 +46,7 @@ def test_should_load_inline():
     assert secrets["kubernetes"]["api_server_url"] == "http://1.2.3.4"
 
 
+@patch.dict(os.environ, {"KUBE_API_URL": "http://1.2.3.4"})
 def test_should_merge_properly():
     secrets = load_secrets(
         {
@@ -247,8 +248,8 @@ def test_read_secrets_from_vault_with_kv_version_2(hvac):
     assert secrets["k8s"]["a-secret"] == "bar"
 
 
+@patch.dict(os.environ, {"KUBE_API_URL": "http://1.2.3.4"})
 def test_override_load_environmen_with_var():
-    os.environ["KUBE_API_URL"] = "http://1.2.3.4"
     secrets = load_secrets(
         {"kubernetes": {"api_server_url": {"type": "env", "key": "KUBE_API_URL"}}},
         config.EmptyConfig,