From 8c7b8e1e26cf9b77ef3d5118a9ac76ced8980dca Mon Sep 17 00:00:00 2001 From: Kartik Ohri Date: Thu, 12 Dec 2024 00:42:40 +0530 Subject: [PATCH 1/2] Remove unneeded oauth config --- config.py.example | 1 - consul_config.py.ctmpl | 1 - develop.sh | 2 +- frontend/js/src/forms/DeleteApplication.tsx | 6 +++++- oauth/__init__.py | 3 --- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/config.py.example b/config.py.example index ca30072a..0a91414f 100644 --- a/config.py.example +++ b/config.py.example @@ -48,7 +48,6 @@ STRIPE_KEYS = { # if developing payment integration locally, change this to your localhost url SERVER_BASE_URL = "http://localhost:8000" -SERVER_NAME = "localhost:8000" MUSICBRAINZ_SERVER = "https://beta.musicbrainz.org" diff --git a/consul_config.py.ctmpl b/consul_config.py.ctmpl index f389cb36..6bd69f57 100644 --- a/consul_config.py.ctmpl +++ b/consul_config.py.ctmpl @@ -87,7 +87,6 @@ MAIL_FROM_DOMAIN = '''{{template "KEY" "mail_from_domain"}}''' PREFERRED_URL_SCHEME = '''{{template "KEY" "preferred_url_scheme"}}''' SERVER_BASE_URL = f"{PREFERRED_URL_SCHEME}://{MAIL_FROM_DOMAIN}" -SERVER_NAME = None {{if service "pgbouncer-slave"}} {{with index (service "pgbouncer-slave") 0}} diff --git a/develop.sh b/develop.sh index 7b2e34a4..599cd5a9 100755 --- a/develop.sh +++ b/develop.sh @@ -22,7 +22,7 @@ function invoke_docker_compose { } function invoke_manage { - invoke_docker_compose run --rm meb_web \ + invoke_docker_compose run --rm web \ python3 manage.py \ "$@" } diff --git a/frontend/js/src/forms/DeleteApplication.tsx b/frontend/js/src/forms/DeleteApplication.tsx index 6b365f38..ebc57896 100644 --- a/frontend/js/src/forms/DeleteApplication.tsx +++ b/frontend/js/src/forms/DeleteApplication.tsx @@ -47,7 +47,11 @@ function DeleteApplication({ Cancel - diff --git a/oauth/__init__.py b/oauth/__init__.py index 64073e35..b01ab882 100644 --- a/oauth/__init__.py +++ b/oauth/__init__.py @@ -48,9 +48,6 @@ def create_app(debug=None, config_path=None): "..", "config.py" )) - app.config["SERVER_BASE_URL"] = "http://localhost:8150" - app.config["SERVER_NAME"] = "localhost:8150" - # Load configuration files: If we're running under a docker deployment, wait until # the consul configuration is available. if deploy_env: From 78917c89ca61548678d08c4071278d287dd88246 Mon Sep 17 00:00:00 2001 From: Kartik Ohri Date: Thu, 12 Dec 2024 10:41:48 +0530 Subject: [PATCH 2/2] fix tests --- oauth/tests/test_oauth_authorization_code.py | 2 +- oauth/tests/test_oauth_implicit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oauth/tests/test_oauth_authorization_code.py b/oauth/tests/test_oauth_authorization_code.py index 1c7051fa..fee51fce 100644 --- a/oauth/tests/test_oauth_authorization_code.py +++ b/oauth/tests/test_oauth_authorization_code.py @@ -462,7 +462,7 @@ def test_oauth_authorize_logged_out(self): self.assertEqual(parsed.path, "/login") fragment_args = parse_qs(parsed.query) - self.assertEqual(unquote(fragment_args["returnto"][0]), f"http://{self.app.config['SERVER_NAME']}/oauth2/authorize?client_id={application['client_id']}&response_type=code&scope=test-scope-1&state=random-state&redirect_uri=https://example.com/callback") + self.assertEqual(unquote(fragment_args["returnto"][0]), f"http://localhost/oauth2/authorize?client_id={application['client_id']}&response_type=code&scope=test-scope-1&state=random-state&redirect_uri=https://example.com/callback") @pytest.mark.skip def test_oauth_authorize_parameter_reuse(self): diff --git a/oauth/tests/test_oauth_implicit.py b/oauth/tests/test_oauth_implicit.py index 2053190d..8b26e8c2 100644 --- a/oauth/tests/test_oauth_implicit.py +++ b/oauth/tests/test_oauth_implicit.py @@ -180,7 +180,7 @@ def test_oauth_authorize_logged_out(self): self.assertEqual(parsed.path, "/login") fragment_args = parse_qs(parsed.query) - self.assertEqual(unquote(fragment_args["returnto"][0]), f"http://{self.app.config['SERVER_NAME']}/oauth2/authorize?client_id={application['client_id']}&response_type=token&scope=test-scope-1&state=random-state&redirect_uri=https://example.com/callback") + self.assertEqual(unquote(fragment_args["returnto"][0]), f"http://localhost/oauth2/authorize?client_id={application['client_id']}&response_type=token&scope=test-scope-1&state=random-state&redirect_uri=https://example.com/callback") def test_oauth_authorize_multiple_redirect_uris(self): application = self.create_oauth_app(redirect_uris=[