Files
zulip/zilencer/tests.py
Luke Faraone 2d787e952b Expose an endpoint to identify the API/webclient bases for a particular user.
We fall back to guessing based on the realm if the user doesn't have a
profile in our system

(imported from commit 833885168c451074c885b4422d62986855a215f7)
2013-10-25 15:18:38 -04:00

21 lines
848 B
Python

# -*- coding: utf-8 -*-
from __future__ import absolute_import
import ujson
from django.test import TestCase
class EndpointDiscoveryTest(TestCase):
def test_staging_user(self):
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://staging.zulip.com/")
self.assertEqual(data["result"]["base_api_url"], "https://staging.zulip.com/api/")
def test_prod_user(self):
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/")