372
372
conf_1 = config._Config(conf_file)
373
373
self.assertEquals(True, conf_1.get_autoconnect())
375
def test_load_show_all_notifications(self):
376
"""Test load/set/override of show_all_notifications config value."""
377
conf_file = os.path.join(self.test_root,
378
'test_show_all_notifications_config.conf')
379
# ensure that show_all_notifications is True
380
with open(conf_file, 'w') as fp:
381
fp.write('[notifications]\n')
382
fp.write('show_all_notifications = True\n')
384
# keep a original around
385
conf_orig = config._Config(conf_file)
387
# assert default is correct
388
self.assertTrue(conf_orig.get_show_all_notifications(),
389
'show_all_notifications is True by default.')
392
conf = config._Config(conf_file)
393
self.assertTrue(conf.get_show_all_notifications())
396
conf.set_show_all_notifications(False)
397
self.assertFalse(conf.get_show_all_notifications())
399
# save, load and check
401
conf_1 = config._Config(conf_file)
402
self.assertFalse(conf_1.get_show_all_notifications())
404
conf.set_show_all_notifications(True)
405
self.assertTrue(conf.get_show_all_notifications())
406
# save, load and check
408
conf_1 = config._Config(conf_file)
409
self.assertTrue(conf_1.get_show_all_notifications())
411
# load the config, check the override of the value
412
conf = config._Config(conf_file)
413
self.assertTrue(conf.get_show_all_notifications())
414
overridden_opts = [('notifications', 'show_all_notifications', False)]
415
conf.override_options(overridden_opts)
416
self.assertFalse(conf.get_show_all_notifications())
417
self.assertNotEqual(conf.get_show_all_notifications(),
418
conf_orig.get_show_all_notifications())
420
conf_1 = config._Config(conf_file)
421
self.assertEquals(True, conf_1.get_show_all_notifications())
376
424
class ConfigglueParsersTests(BaseTwistedTestCase):
377
425
"""Tests for our custom configglue parsers"""