api: Delete ancient fetch_google_client_id endpoint.

This was used by the old native Zulip Android app
(zulip/zulip-android).  That app has been undeveloped for enough years
that we believe it no longer functions; as a result, there's no reason
to keep a prototype API endpoint for it (that we believe never worked).
This commit is contained in:
Tim Abbott
2021-04-07 21:23:51 -07:00
committed by Tim Abbott
parent fdf44f19b2
commit 1470dd9105
6 changed files with 2 additions and 41 deletions

View File

@@ -134,7 +134,7 @@ want those settings.
### Testing non-default settings ### Testing non-default settings
You can write tests for settings using e.g. `with You can write tests for settings using e.g. `with
self.settings(GOOGLE_CLIENT_ID=None)`. However, this only works for self.settings(TERMS_OF_SERVICE=None)`. However, this only works for
settings which are checked at runtime, not settings which are only settings which are checked at runtime, not settings which are only
accessed in initialization of Django (or Zulip) internals accessed in initialization of Django (or Zulip) internals
(e.g. `DATABASES`). See the [Django docs on overriding settings in (e.g. `DATABASES`). See the [Django docs on overriding settings in

View File

@@ -287,10 +287,7 @@ class OpenAPIArgumentsTest(ZulipTestCase):
"/realm/logo", "/realm/logo",
"/realm/deactivate", "/realm/deactivate",
"/realm/subdomain/{subdomain}", "/realm/subdomain/{subdomain}",
#### Other low value endpoints # API for Zoom video calls. Unclear if this can support other apps.
# Used for failed approach with dead Android app.
"/fetch_google_client_id",
# API for video calls we're planning to remove/replace.
"/calls/zoom/create", "/calls/zoom/create",
#### The following are fake endpoints that live in our zulip.yaml #### The following are fake endpoints that live in our zulip.yaml
#### for tooling convenience reasons, and should eventually be moved. #### for tooling convenience reasons, and should eventually be moved.

View File

@@ -3,7 +3,6 @@ import os
from typing import List, Optional from typing import List, Optional
import django.urls.resolvers import django.urls.resolvers
import orjson
from django.test import Client from django.test import Client
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
@@ -97,28 +96,6 @@ class PublicURLTest(ZulipTestCase):
for status_code, url_set in patch_urls.items(): for status_code, url_set in patch_urls.items():
self.fetch("client_patch", url_set, status_code) self.fetch("client_patch", url_set, status_code)
def test_get_gcid_when_not_configured(self) -> None:
with self.settings(GOOGLE_CLIENT_ID=None):
resp = self.client_get("/api/v1/fetch_google_client_id")
self.assertEqual(
400,
resp.status_code,
msg=f"Expected 400, received {resp.status_code} for GET /api/v1/fetch_google_client_id",
)
self.assertEqual("error", resp.json()["result"])
def test_get_gcid_when_configured(self) -> None:
with self.settings(GOOGLE_CLIENT_ID="ABCD"):
resp = self.client_get("/api/v1/fetch_google_client_id")
self.assertEqual(
200,
resp.status_code,
msg=f"Expected 200, received {resp.status_code} for GET /api/v1/fetch_google_client_id",
)
data = orjson.loads(resp.content)
self.assertEqual("success", data["result"])
self.assertEqual("ABCD", data["google_client_id"])
def test_config_error_endpoints_dev_env(self) -> None: def test_config_error_endpoints_dev_env(self) -> None:
""" """
The content of these pages is tested separately. The content of these pages is tested separately.

View File

@@ -1057,13 +1057,6 @@ def json_fetch_api_key(
return json_success({"api_key": api_key, "email": user_profile.delivery_email}) return json_success({"api_key": api_key, "email": user_profile.delivery_email})
@csrf_exempt
def api_fetch_google_client_id(request: HttpRequest) -> HttpResponse:
if not settings.GOOGLE_CLIENT_ID:
return json_error(_("GOOGLE_CLIENT_ID is not configured"), status=400)
return json_success({"google_client_id": settings.GOOGLE_CLIENT_ID})
@require_post @require_post
def logout_then_login(request: HttpRequest, **kwargs: Any) -> HttpResponse: def logout_then_login(request: HttpRequest, **kwargs: Any) -> HttpResponse:
return django_logout_then_login(request, kwargs) return django_logout_then_login(request, kwargs)

View File

@@ -243,9 +243,6 @@ SYSTEM_BOT_REALM = "zulipinternal"
# than a separate app. # than a separate app.
EXTRA_INSTALLED_APPS = ["analytics"] EXTRA_INSTALLED_APPS = ["analytics"]
# Default GOOGLE_CLIENT_ID to the value needed for Android auth to work
GOOGLE_CLIENT_ID = "835904834568-77mtr5mtmpgspj9b051del9i9r5t4g4n.apps.googleusercontent.com"
# Used to construct URLs to point to the Zulip server. Since we # Used to construct URLs to point to the Zulip server. Since we
# only support HTTPS in production, this is just for development. # only support HTTPS in production, this is just for development.
EXTERNAL_URI_SCHEME = "https://" EXTERNAL_URI_SCHEME = "https://"

View File

@@ -24,7 +24,6 @@ from zerver.views.auth import (
api_dev_fetch_api_key, api_dev_fetch_api_key,
api_dev_list_users, api_dev_list_users,
api_fetch_api_key, api_fetch_api_key,
api_fetch_google_client_id,
api_get_server_settings, api_get_server_settings,
dev_direct_login, dev_direct_login,
json_fetch_api_key, json_fetch_api_key,
@@ -723,8 +722,6 @@ v1_api_mobile_patterns = [
path("dev_fetch_api_key", api_dev_fetch_api_key), path("dev_fetch_api_key", api_dev_fetch_api_key),
# This is for fetching the emails of the admins and the users. # This is for fetching the emails of the admins and the users.
path("dev_list_users", api_dev_list_users), path("dev_list_users", api_dev_list_users),
# Used to present the GOOGLE_CLIENT_ID to mobile apps
path("fetch_google_client_id", api_fetch_google_client_id),
] ]
urls += [ urls += [
path("api/v1/", include(v1_api_mobile_patterns)), path("api/v1/", include(v1_api_mobile_patterns)),