diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2019-09-07 13:14:45 -0400 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2019-09-07 13:14:45 -0400 |
commit | 0d61d1d7351a8d2e2512dbcaf149e1f19f2271ec (patch) | |
tree | 9dccb1711608f8c0b3a6dcd22eaa6f100c7a4e17 /tests/config/test_load.py | |
parent | use something that's the right type for user_id (diff) | |
parent | Servers-known-about statistic (#5981) (diff) | |
download | synapse-0d61d1d7351a8d2e2512dbcaf149e1f19f2271ec.tar.xz |
Merge branch 'develop' into cross-signing_sig_upload
Diffstat (limited to 'tests/config/test_load.py')
-rw-r--r-- | tests/config/test_load.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/tests/config/test_load.py b/tests/config/test_load.py index 6bfc1970ad..b3e557bd6a 100644 --- a/tests/config/test_load.py +++ b/tests/config/test_load.py @@ -15,6 +15,8 @@ import os.path import shutil import tempfile +from contextlib import redirect_stdout +from io import StringIO import yaml @@ -26,7 +28,6 @@ from tests import unittest class ConfigLoadingTestCase(unittest.TestCase): def setUp(self): self.dir = tempfile.mkdtemp() - print(self.dir) self.file = os.path.join(self.dir, "homeserver.yaml") def tearDown(self): @@ -94,18 +95,27 @@ class ConfigLoadingTestCase(unittest.TestCase): ) self.assertTrue(config.enable_registration) + def test_stats_enabled(self): + self.generate_config_and_remove_lines_containing("enable_metrics") + self.add_lines_to_config(["enable_metrics: true"]) + + # The default Metrics Flags are off by default. + config = HomeServerConfig.load_config("", ["-c", self.file]) + self.assertFalse(config.metrics_flags.known_servers) + def generate_config(self): - HomeServerConfig.load_or_generate_config( - "", - [ - "--generate-config", - "-c", - self.file, - "--report-stats=yes", - "-H", - "lemurs.win", - ], - ) + with redirect_stdout(StringIO()): + HomeServerConfig.load_or_generate_config( + "", + [ + "--generate-config", + "-c", + self.file, + "--report-stats=yes", + "-H", + "lemurs.win", + ], + ) def generate_config_and_remove_lines_containing(self, needle): self.generate_config() |