home: Ignore handlebars errors in the test suite.

The handlebars error message is just for the manual development
environment; this prevents the state of compiling handlebars templates
from run-dev.py from potentially causing the unit tests to fail.
This commit is contained in:
Tim Abbott 2018-04-28 13:46:59 -07:00
parent 7d6bb3dcb4
commit e087be6630
2 changed files with 3 additions and 2 deletions

View File

@ -612,7 +612,7 @@ class HomeTest(ZulipTestCase):
def test_handlebars_compile_error(self) -> None:
request = HostRequestMock()
with self.settings(DEVELOPMENT=True):
with self.settings(DEVELOPMENT=True, TEST_SUITE=False):
with patch('os.path.exists', return_value=True):
result = home(request)
self.assertEqual(result.status_code, 500)

View File

@ -75,7 +75,8 @@ def get_bot_types(user_profile: UserProfile) -> List[Dict[str, object]]:
return bot_types
def home(request: HttpRequest) -> HttpResponse:
if settings.DEVELOPMENT and os.path.exists('var/handlebars-templates/compile.error'):
if (settings.DEVELOPMENT and not settings.TEST_SUITE and
os.path.exists('var/handlebars-templates/compile.error')):
response = render(request, 'zerver/handlebars_compilation_failed.html')
response.status_code = 500
return response