From 2d38626d42559299e20b74b75b71008d9e23f976 Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Fri, 21 Jan 2022 15:23:55 -0800 Subject: [PATCH] client: update valid urls --- mpcontribs-client/mpcontribs/client/__init__.py | 8 ++------ mpcontribs-client/mpcontribs/client/test_client.py | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mpcontribs-client/mpcontribs/client/__init__.py b/mpcontribs-client/mpcontribs/client/__init__.py index abb8c1e1f..747ce36ef 100644 --- a/mpcontribs-client/mpcontribs/client/__init__.py +++ b/mpcontribs-client/mpcontribs/client/__init__.py @@ -64,12 +64,8 @@ PROVIDERS = {"github", "google", "facebook", "microsoft", "amazon"} COMPONENTS = ["structures", "tables", "attachments"] # using list to maintain order SUBDOMAINS = ["contribs", "lightsources", "ml", "workshop-contribs"] -LOCAL_STACK = { - "contribs-api": 5000, "workshop-contribs-api": 5005, - "contribs-ml-api": 5002, "contribs-lightsources-api": 5003, -} -VALID_URLS = {f"http://localhost:{p}" for p in LOCAL_STACK.values()} # AWS Fargate Task -VALID_URLS |= {f"http://{h}:{p}" for h, p in LOCAL_STACK.items()} # local docker-compose stack +PORTS = [5000, 5002, 5003, 5005] +VALID_URLS = {f"http://{h}:{p}" for p in PORTS for h in ["localhost", "contribs-apis"]} VALID_URLS |= { f"https://{n}-api{m}.materialsproject.org" for n in SUBDOMAINS for m in ["", "-preview"] diff --git a/mpcontribs-client/mpcontribs/client/test_client.py b/mpcontribs-client/mpcontribs/client/test_client.py index 49203c0a5..07ede1ba8 100644 --- a/mpcontribs-client/mpcontribs/client/test_client.py +++ b/mpcontribs-client/mpcontribs/client/test_client.py @@ -33,11 +33,11 @@ def test_Client(): assert spec.spec_dict["schemes"] == ["http"] assert spec.user_defined_formats["email"] == email_format - kwargs = {"host": "contribs-api:5000"} + kwargs = {"host": "contribs-apis:5000"} spec = Client(**kwargs).swagger_spec assert spec.http_client.headers == {"Content-Type": "application/json"} - assert spec.origin_url == "http://contribs-api:5000/apispec.json" - assert spec.spec_dict["host"] == "contribs-api:5000" + assert spec.origin_url == "http://contribs-apis:5000/apispec.json" + assert spec.spec_dict["host"] == "contribs-apis:5000" assert spec.spec_dict["schemes"] == ["http"] assert spec.user_defined_formats["email"] == email_format