11import textwrap
22from unittest import TestCase
33
4+ from redash import settings
45from redash .models import OPERATORS , Alert , db , next_state
56from tests import BaseTestCase
67
@@ -153,6 +154,10 @@ def create_alert(self, results, column="foo", value="5"):
153154 return alert
154155
155156 def test_render_custom_alert_template (self ):
157+ old_host = settings .HOST
158+ old_multi_org = settings .MULTI_ORG
159+ settings .HOST = "http://localhost:5001"
160+ settings .MULTI_ORG = False
156161 alert = self .create_alert (get_results (1 ))
157162 custom_alert = """
158163 <pre>
@@ -176,9 +181,9 @@ def test_render_custom_alert_template(self):
176181 ALERT_CONDITION equals
177182 ALERT_THRESHOLD 5
178183 ALERT_NAME %s
179- ALERT_URL https :///default /alerts/%d
184+ ALERT_URL http ://localhost:5001 /alerts/%d
180185 QUERY_NAME Query
181- QUERY_URL https :///default /queries/%d
186+ QUERY_URL http ://localhost:5001 /queries/%d
182187 QUERY_RESULT_VALUE 1
183188 QUERY_RESULT_ROWS [{'foo': 1}]
184189 QUERY_RESULT_COLS [{'name': 'foo', 'type': 'STRING'}]
@@ -190,6 +195,8 @@ def test_render_custom_alert_template(self):
190195 )
191196 result = alert .render_template (textwrap .dedent (custom_alert ))
192197 self .assertMultiLineEqual (result , textwrap .dedent (expected ))
198+ settings .HOST = old_host
199+ settings .MULTI_ORG = old_multi_org
193200
194201 def test_render_custom_alert_template_query_table (self ):
195202 alert = self .create_alert (get_results (1 ))
0 commit comments