@@ -37,12 +37,16 @@ def test_get_found(self):
3737 store = self ._make_store ()
3838 mock_client = MagicMock ()
3939 mock_client .get_parameter .return_value = {"Parameter" : {"Value" : "secret123" }}
40- mock_client .exceptions .ParameterNotFound = type ("ParameterNotFound" , (Exception ,), {})
40+ mock_client .exceptions .ParameterNotFound = type (
41+ "ParameterNotFound" , (Exception ,), {}
42+ )
4143
4244 with patch .object (store , "_get_client" , return_value = mock_client ):
4345 result = store .get ("DB_PASSWORD" )
4446 assert result == "secret123"
45- mock_client .get_parameter .assert_called_once_with (Name = "/myapp/DB_PASSWORD" , WithDecryption = True )
47+ mock_client .get_parameter .assert_called_once_with (
48+ Name = "/myapp/DB_PASSWORD" , WithDecryption = True
49+ )
4650
4751 def test_get_not_found (self ):
4852 store = self ._make_store ()
@@ -123,7 +127,10 @@ def test_boto3_not_installed(self):
123127 from envault .stores import AwsSsmStore , SecretStoreError
124128
125129 store = AwsSsmStore ()
126- with patch .dict ("sys.modules" , {"boto3" : None }), pytest .raises (SecretStoreError , match = "boto3 not installed" ):
130+ with (
131+ patch .dict ("sys.modules" , {"boto3" : None }),
132+ pytest .raises (SecretStoreError , match = "boto3 not installed" ),
133+ ):
127134 store ._get_client ()
128135
129136
@@ -144,7 +151,12 @@ def test_init_defaults(self):
144151 def test_init_with_params (self ):
145152 from envault .stores import VaultStore
146153
147- store = VaultStore (url = "https://vault.example.com" , token = "s.abc" , mount_point = "kv" , path_prefix = "myapp" )
154+ store = VaultStore (
155+ url = "https://vault.example.com" ,
156+ token = "s.abc" ,
157+ mount_point = "kv" ,
158+ path_prefix = "myapp" ,
159+ )
148160 assert store .url == "https://vault.example.com"
149161 assert store .token == "s.abc"
150162 assert store .mount_point == "kv"
@@ -167,7 +179,9 @@ def test_get_found(self):
167179
168180 store = VaultStore (token = "s.test" )
169181 mock_client = MagicMock ()
170- mock_client .secrets .kv .v2 .read_secret .return_value = {"data" : {"data" : {"value" : "secret_val" }}}
182+ mock_client .secrets .kv .v2 .read_secret .return_value = {
183+ "data" : {"data" : {"value" : "secret_val" }}
184+ }
171185
172186 with patch .object (store , "_get_client" , return_value = mock_client ):
173187 result = store .get ("MY_KEY" )
@@ -210,7 +224,9 @@ def test_delete_not_found(self):
210224
211225 store = VaultStore (token = "s.test" )
212226 mock_client = MagicMock ()
213- mock_client .secrets .kv .v2 .delete_metadata_and_all_versions .side_effect = Exception ("404" )
227+ mock_client .secrets .kv .v2 .delete_metadata_and_all_versions .side_effect = (
228+ Exception ("404" )
229+ )
214230
215231 with patch .object (store , "_get_client" , return_value = mock_client ):
216232 result = store .delete ("MISSING" )
@@ -221,7 +237,9 @@ def test_list_keys(self):
221237
222238 store = VaultStore (token = "s.test" )
223239 mock_client = MagicMock ()
224- mock_client .secrets .kv .v2 .list_secrets .return_value = {"data" : {"keys" : ["DB_HOST" , "DB_PORT" , "API_KEY/" ]}}
240+ mock_client .secrets .kv .v2 .list_secrets .return_value = {
241+ "data" : {"keys" : ["DB_HOST" , "DB_PORT" , "API_KEY/" ]}
242+ }
225243
226244 with patch .object (store , "_get_client" , return_value = mock_client ):
227245 keys = store .list_keys ()
@@ -257,7 +275,10 @@ def test_hvac_not_installed(self):
257275 from envault .stores import SecretStoreError , VaultStore
258276
259277 store = VaultStore ()
260- with patch .dict ("sys.modules" , {"hvac" : None }), pytest .raises (SecretStoreError , match = "hvac not installed" ):
278+ with (
279+ patch .dict ("sys.modules" , {"hvac" : None }),
280+ pytest .raises (SecretStoreError , match = "hvac not installed" ),
281+ ):
261282 store ._get_client ()
262283
263284
@@ -276,7 +297,14 @@ def test_get_found(self):
276297 url = "https://api.doppler.com/v3/configs/config/secrets"
277298
278299 with responses .RequestsMock () as rsps :
279- rsps .get (url , json = {"secrets" : {"MY_KEY" : {"raw" : "raw_val" , "computed" : "computed_val" }}})
300+ rsps .get (
301+ url ,
302+ json = {
303+ "secrets" : {
304+ "MY_KEY" : {"raw" : "raw_val" , "computed" : "computed_val" }
305+ }
306+ },
307+ )
280308 result = store .get ("MY_KEY" )
281309 assert result == "raw_val"
282310
@@ -289,7 +317,10 @@ def test_get_falls_back_to_computed(self):
289317 url = "https://api.doppler.com/v3/configs/config/secrets"
290318
291319 with responses .RequestsMock () as rsps :
292- rsps .get (url , json = {"secrets" : {"MY_KEY" : {"raw" : " " , "computed" : "computed_val" }}})
320+ rsps .get (
321+ url ,
322+ json = {"secrets" : {"MY_KEY" : {"raw" : " " , "computed" : "computed_val" }}},
323+ )
293324 result = store .get ("MY_KEY" )
294325 assert result == "computed_val"
295326
@@ -302,7 +333,9 @@ def test_list_keys_with_prefix(self):
302333 url = "https://api.doppler.com/v3/configs/config/secrets"
303334
304335 with responses .RequestsMock () as rsps :
305- rsps .get (url , json = {"secrets" : {"DB_HOST" : {}, "DB_PORT" : {}, "API_KEY" : {}}})
336+ rsps .get (
337+ url , json = {"secrets" : {"DB_HOST" : {}, "DB_PORT" : {}, "API_KEY" : {}}}
338+ )
306339 keys = store .list_keys (prefix = "DB_" )
307340 assert "DB_HOST" in keys
308341 assert "DB_PORT" in keys
@@ -435,7 +468,16 @@ def test_list_keys_with_prefix(self):
435468 url = "http://localhost:8080/v1/vaults/v1/items"
436469
437470 with responses .RequestsMock () as rsps :
438- rsps .get (url , json = {"items" : [{"title" : "DB_HOST" }, {"title" : "DB_PORT" }, {"title" : "API_KEY" }]})
471+ rsps .get (
472+ url ,
473+ json = {
474+ "items" : [
475+ {"title" : "DB_HOST" },
476+ {"title" : "DB_PORT" },
477+ {"title" : "API_KEY" },
478+ ]
479+ },
480+ )
439481 keys = store .list_keys (prefix = "DB_" )
440482 assert keys == ["DB_HOST" , "DB_PORT" ]
441483
@@ -459,7 +501,9 @@ def test_vault_config(self):
459501 from envault .config import SecretStoreConfig
460502 from envault .stores import VaultStore , get_store
461503
462- config = SecretStoreConfig (type = "vault" , path_prefix = "myapp" , token_env_var = "VAULT_TOKEN" )
504+ config = SecretStoreConfig (
505+ type = "vault" , path_prefix = "myapp" , token_env_var = "VAULT_TOKEN"
506+ )
463507 with patch .dict ("os.environ" , {"VAULT_TOKEN" : "s.test" }):
464508 store = get_store (config )
465509 assert isinstance (store , VaultStore )
@@ -469,7 +513,9 @@ def test_doppler_config(self):
469513 from envault .config import SecretStoreConfig
470514 from envault .stores import DopplerStore , get_store
471515
472- config = SecretStoreConfig (type = "doppler" , path_prefix = "myproj" , token_env_var = "DOPPLER_TOKEN" )
516+ config = SecretStoreConfig (
517+ type = "doppler" , path_prefix = "myproj" , token_env_var = "DOPPLER_TOKEN"
518+ )
473519 with patch .dict ("os.environ" , {"DOPPLER_TOKEN" : "dp.test" }):
474520 store = get_store (config )
475521 assert isinstance (store , DopplerStore )
@@ -479,8 +525,13 @@ def test_onepassword_config(self):
479525 from envault .config import SecretStoreConfig
480526 from envault .stores import OnePasswordStore , get_store
481527
482- config = SecretStoreConfig (type = "onepassword" , path_prefix = "vault1" , token_env_var = "OP_TOKEN" )
483- with patch .dict ("os.environ" , {"OP_TOKEN" : "op.test" , "OP_CONNECT_URL" : "https://op.example.com" }):
528+ config = SecretStoreConfig (
529+ type = "onepassword" , path_prefix = "vault1" , token_env_var = "OP_TOKEN"
530+ )
531+ with patch .dict (
532+ "os.environ" ,
533+ {"OP_TOKEN" : "op.test" , "OP_CONNECT_URL" : "https://op.example.com" },
534+ ):
484535 store = get_store (config )
485536 assert isinstance (store , OnePasswordStore )
486537 assert store .token == "op.test"
0 commit comments