Skip to content
Snippets Groups Projects
Commit d949a217 authored by Christian Boettcher's avatar Christian Boettcher
Browse files

fix error that happens with empty metadata

parent 48cc1375
Branches
Tags 1.0.4
No related merge requests found
Pipeline #90587 passed
......@@ -17,7 +17,10 @@ def get_connection_with_secrets_from_entry(data: Dict[str, Any], secrets: Dict[s
conn.password = secrets.get('password')
conn.login = secrets.get('login')
# add all remaining secrets to extra
try:
extra = json.loads(conn.extra)
except TypeError: # may happen if extra is empty
extra = {}
for key in secrets.keys():
if key in ['password', 'login']:
continue
......
......@@ -27,6 +27,10 @@ class TestSecretsBackend(TestCase):
self.assertEqual(conn.extra_dejson['some_other_extra_to_be_overwritten_by_secret'], "secret_67890")
def test_no_error_on_missing_extra(self):
get_connection_with_secrets_from_entry({"name" : "some-name", "url" : "some_url", "metadata" : {}}, {}, "test-connection", 'false_oid')
class TestSecretsConnection(TestCase):
def setUp(self):
load_dotenv("tests/testing-authentication.env", verbose=False) # does nothing if file is not present
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment