summaryrefslogtreecommitdiff
path: root/tests/settings
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-08-16 11:05:06 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-08-16 11:05:06 -0700
commit8ceb87c911fbfa010e4a9bf1ad098f4b632724d1 (patch)
tree55ed56718c1bdf87a9aa5e5f87e277161915c6bb /tests/settings
parentc035ec89603fefc436abd935bb768d581a269188 (diff)
tests/settings/manager: Add tests for Null config files
Which fail, per #1094
Diffstat (limited to 'tests/settings')
-rw-r--r--tests/settings/manager_test.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/settings/manager_test.py b/tests/settings/manager_test.py
index 3201ad41..04f35504 100644
--- a/tests/settings/manager_test.py
+++ b/tests/settings/manager_test.py
@@ -63,6 +63,39 @@ class TestSettingsManager(unittest.TestCase):
actual = manager.get_notmuch_setting('maildir', 'synchronize_flags')
self.assertTrue(actual)
+ @unittest.expectedFailure
+ def test_read_config_doesnt_exist(self):
+ """If there is not an alot config things don't break.
+
+ This specifically tests for issue #1094, which is caused by the
+ defaults not being loaded if there isn't an alot config files, and thus
+ calls like `get_theming_attribute` fail with strange exceptions.
+ """
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ f.write(textwrap.dedent("""\
+ [maildir]
+ synchronize_flags = true
+ """))
+ self.addCleanup(os.unlink, f.name)
+ manager = SettingsManager(notmuch_rc=f.name)
+
+ manager.get_theming_attribute('global', 'body')
+
+ @unittest.expectedFailure
+ def test_read_notmuch_config_doesnt_exist(self):
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ f.write(textwrap.dedent("""\
+ [accounts]
+ [[default]]
+ realname = That Guy
+ address = thatguy@example.com
+ """))
+ self.addCleanup(os.unlink, f.name)
+ manager = SettingsManager(alot_rc=f.name)
+
+ setting = manager.get_notmuch_setting('foo', 'bar')
+ self.assertIsNone(setting)
+
class TestSettingsManagerGetAccountByAddress(utilities.TestCaseClassCleanup):
"""Test the get_account_by_address helper."""