Add a test for BMConfigParser.setTemp()

This commit is contained in:
Dmitri Bogomolov 2022-02-17 00:39:48 +02:00
parent 858705357a
commit e778ee9231
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -75,6 +75,18 @@ class TestConfig(unittest.TestCase):
self.assertEqual(
self.config.safeGetFloat('nonexistent', 'nonexistent', 42.0), 42.0)
def test_setTemp(self):
"""Set a temporary value and ensure it's returned by get()"""
self.config.setTemp('bitmessagesettings', 'connect', 'true')
self.assertIs(
self.config.safeGetBoolean('bitmessagesettings', 'connect'), True)
written_fp = StringIO('')
self.config.write(written_fp)
self.config._reset()
self.config.read_file(written_fp)
self.assertIs(
self.config.safeGetBoolean('bitmessagesettings', 'connect'), False)
def test_reset(self):
"""Some logic for testing _reset()"""
test_config_object = StringIO(test_config)