Skip to content

Commit

Permalink
Cleanup to troubleshoot test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Dec 27, 2023
1 parent 9c34771 commit f8749d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 4 additions & 6 deletions neon_api_proxy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _init_config() -> dict:
from neon_api_proxy.config import get_proxy_config
legacy_config = get_proxy_config()
if legacy_config:
return legacy_config
return legacy_config.get("SERVICES") or legacy_config
legacy_config_file = join(get_xdg_config_save_path(),
"ngi_auth_vars.yml")
if isfile(legacy_config_file):
Expand All @@ -85,11 +85,9 @@ def init_service_instances(self, service_class_mapping: dict) -> dict:
and instance of python class representing it
"""
service_mapping = dict()
for item in list(service_class_mapping):
api_key = self.config.get("SERVICES",
self.config).get(item,
{}).get("api_key") \
if self.config else None
for item in service_class_mapping:
api_key = self.config.get(item, {}).get("api_key") if self.config \
else None
try:
service_mapping[item] = \
service_class_mapping[item](api_key=api_key)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def _override_find_key(*args, **kwargs):
def test_client_init_no_keys(self):
from neon_api_proxy.client import NeonAPIProxyClient
client = NeonAPIProxyClient({"test": "test"})
self.assertEqual(set(client.service_instance_mapping.keys()), {"api_test_endpoint"})
self.assertEqual(set(client.service_instance_mapping.keys()),
{"api_test_endpoint"})

def test_client_lazy_load(self):
from neon_api_proxy.client import NeonAPI, request_api
Expand Down

0 comments on commit f8749d6

Please sign in to comment.