Skip to content

Commit

Permalink
Add a test for BMConfigParser.setTemp()
Browse files Browse the repository at this point in the history
  • Loading branch information
g1itch committed Feb 21, 2022
1 parent 8587053 commit e778ee9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/tests/test_config.py
Expand Up @@ -75,6 +75,18 @@ def test_safeGetFloat(self):
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)
Expand Down

0 comments on commit e778ee9

Please sign in to comment.