mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
tests_classes: Add DEFAULT_SUBDOMAIN feature.
This should make life a little easier for those tests that need to use the same subdomain like 20 times.
This commit is contained in:
@@ -107,6 +107,7 @@ class ZulipTestCase(TestCase):
|
||||
functions have to fake out the linter by using a local variable called
|
||||
django_client to fool the regext.
|
||||
'''
|
||||
DEFAULT_SUBDOMAIN = "zulip"
|
||||
DEFAULT_REALM = Realm.objects.get(string_id='zulip')
|
||||
|
||||
def set_http_host(self, kwargs):
|
||||
@@ -118,7 +119,11 @@ class ZulipTestCase(TestCase):
|
||||
kwargs["HTTP_HOST"] = settings.EXTERNAL_HOST
|
||||
del kwargs['subdomain']
|
||||
elif 'HTTP_HOST' not in kwargs:
|
||||
kwargs["HTTP_HOST"] = "zulip.%s" % (settings.EXTERNAL_HOST,)
|
||||
if self.DEFAULT_SUBDOMAIN == "":
|
||||
kwargs["HTTP_HOST"] = settings.EXTERNAL_HOST
|
||||
else:
|
||||
kwargs["HTTP_HOST"] = "%s.%s" % (self.DEFAULT_SUBDOMAIN,
|
||||
settings.EXTERNAL_HOST,)
|
||||
|
||||
@instrument_url
|
||||
def client_patch(self, url, info={}, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user