tests: Add test for legacy context interpretation

This commit is contained in:
Tomas Babej 2021-10-14 22:35:36 -04:00
parent d5a026d91a
commit f6d9837b07
No known key found for this signature in database
GPG key ID: B0747C6578F7D2F5

View file

@ -206,6 +206,16 @@ class ContextManagementTest(TestCase):
self.assertEqual(len(list(filter(contains_work, out.splitlines()))), 1)
self.assertEqual(len(list(filter(contains_home, out.splitlines()))), 1)
def test_context_list_legacy(self):
"""Test the determination of legacy context definition."""
self.t('config context.old project:Old', input='y\n')
self.t('context old')
code, out, err = self.t('context list')
# Assert that "old" context has only the read component defined
self.assertRegex(out, r'read\s+project:Old\s+yes')
self.assertRegex(out, r'write\s+yes')
def test_context_initially_empty(self):
"""Test that no context is set initially."""
self.t('context define work project:Work', input='y\ny\n')