From f007fc9aaa25086dbb5ead2bd1c233d787bf43bb Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Tue, 5 Jun 2018 21:59:17 -0700 Subject: [PATCH] matrix tests: Add test for case that zuliprc file does not exist. --- zulip/integrations/bridge_with_matrix/test_matrix.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zulip/integrations/bridge_with_matrix/test_matrix.py b/zulip/integrations/bridge_with_matrix/test_matrix.py index 8b796a7..0c8de6d 100644 --- a/zulip/integrations/bridge_with_matrix/test_matrix.py +++ b/zulip/integrations/bridge_with_matrix/test_matrix.py @@ -107,6 +107,18 @@ class MatrixBridgeScriptTests(TestCase): expected_lines[9] = 'site = {}'.format(zulip_params['site']) self.assertEqual(sample_lines, expected_lines[:-1]) + def test_detect_zuliprc_does_not_exist(self): + # type: () -> None + with new_temp_dir() as tempdir: + path = os.path.join(tempdir, sample_config_path) + zuliprc_path = os.path.join(tempdir, "zuliprc") + # No writing of zuliprc file here -> triggers check for zuliprc absence + output_lines = self.output_from_script(["--write-sample-config", path, + "--from-zuliprc", zuliprc_path]) + self.assertEqual(output_lines, + ["Could not write sample config: Zuliprc file '{}' does not exist." + .format(zuliprc_path)]) + class MatrixBridgeZulipToMatrixTests(TestCase): valid_zulip_config = dict( stream="some stream",