Skip to content

Commit

Permalink
client: update valid urls
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Jan 21, 2022
1 parent cfd7a16 commit 2d38626
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions mpcontribs-client/mpcontribs/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions mpcontribs-client/mpcontribs/client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2d38626

Please sign in to comment.