mirror of https://github.com/zulip/zulip.git
zilencer: Remove obsolete lookup_endpoints_for_user endpoint.
This endpoint was part of the same obsolete system as desktop_sso_dispatch.
This commit is contained in:
parent
9e8023843a
commit
69061e6db4
|
@ -1,21 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import
|
||||
|
||||
import ujson
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
class EndpointDiscoveryTest(TestCase):
|
||||
def test_staging_user(self):
|
||||
# type: () -> None
|
||||
response = self.client.get("/api/v1/deployments/endpoints", {"email": "lfaraone@zulip.com"})
|
||||
data = ujson.loads(response.content)
|
||||
self.assertEqual(data["result"]["base_site_url"], "https://zulip.com/")
|
||||
self.assertEqual(data["result"]["base_api_url"], "https://zulip.com/api/")
|
||||
|
||||
def test_prod_user(self):
|
||||
# type: () -> None
|
||||
response = self.client.get("/api/v1/deployments/endpoints", {"email": "lfaraone@mit.edu"})
|
||||
data = ujson.loads(response.content)
|
||||
self.assertEqual(data["result"]["base_site_url"], "https://zulip.com/")
|
||||
self.assertEqual(data["result"]["base_api_url"], "https://api.zulip.com/")
|
|
@ -12,8 +12,6 @@ v1_api_and_json_patterns = [
|
|||
{'POST': 'zilencer.views.submit_feedback'}),
|
||||
url('^deployment/report_error$', rest_dispatch,
|
||||
{'POST': 'zerver.views.report.report_error'}),
|
||||
url('^deployment/endpoints$', zilencer.views.lookup_endpoints_for_user,
|
||||
name='zilencer.views.lookup_endpoints_for_user'),
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
|
|
|
@ -2,7 +2,6 @@ from __future__ import absolute_import
|
|||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.http import HttpResponse, HttpRequest
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from zilencer.models import Deployment
|
||||
|
||||
|
@ -94,13 +93,3 @@ def realm_for_email(email):
|
|||
pass
|
||||
|
||||
return get_realm_by_email_domain(email)
|
||||
|
||||
# Requests made to this endpoint are UNAUTHENTICATED
|
||||
@csrf_exempt
|
||||
@has_request_variables
|
||||
def lookup_endpoints_for_user(request, email=REQ()):
|
||||
# type: (HttpRequest, str) -> HttpResponse
|
||||
try:
|
||||
return json_response(realm_for_email(email).deployment.endpoints)
|
||||
except AttributeError:
|
||||
return json_error(_("Cannot determine endpoint for user."), status=404)
|
||||
|
|
Loading…
Reference in New Issue