mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
#9 TI-1: Make undo work with config actions
This commit is contained in:
parent
0688e3ba07
commit
d230e40313
2 changed files with 74 additions and 1 deletions
52
test/undo.t
52
test/undo.t
|
@ -61,6 +61,58 @@ class TestUndo(TestCase):
|
|||
expectedStart=one_hour_before_utc,
|
||||
expectedTags=["foo"])
|
||||
|
||||
def test_undo_config_add_name(self):
|
||||
"""Test undo of command 'config' (add name)"""
|
||||
self.t("config foo bar :yes")
|
||||
|
||||
before = [x for x in self.t.timewrc_content if x != '\n']
|
||||
|
||||
self.t("undo")
|
||||
|
||||
after = [x for x in self.t.timewrc_content if x != '\n']
|
||||
|
||||
self.assertNotEqual(before, after)
|
||||
self.assertEqual([], after)
|
||||
|
||||
def test_undo_config_remove_name(self):
|
||||
"""Test undo of command 'config' (remove name)"""
|
||||
self.t("config foo bar :yes")
|
||||
self.t("config foo :yes")
|
||||
|
||||
before = self.t.timewrc_content[:]
|
||||
|
||||
self.t("undo")
|
||||
|
||||
after = self.t.timewrc_content[:]
|
||||
|
||||
self.assertNotEqual(before, after)
|
||||
|
||||
def test_undo_config_set_value(self):
|
||||
"""Test undo of command 'config' (set value)"""
|
||||
self.t("config foo bar :yes")
|
||||
self.t("config foo baz :yes")
|
||||
|
||||
before = self.t.timewrc_content[:]
|
||||
|
||||
self.t("undo")
|
||||
|
||||
after = self.t.timewrc_content[:]
|
||||
|
||||
self.assertNotEqual(before, after)
|
||||
|
||||
def test_undo_config_remove_value(self):
|
||||
"""Test undo of command 'config' (remove value)"""
|
||||
self.t("config foo bar :yes")
|
||||
self.t("config foo '' :yes")
|
||||
|
||||
before = self.t.timewrc_content[:]
|
||||
|
||||
self.t("undo")
|
||||
|
||||
after = self.t.timewrc_content[:]
|
||||
|
||||
self.assertNotEqual(before, after)
|
||||
|
||||
def test_undo_continue(self):
|
||||
"""Test undo of command 'continue'"""
|
||||
now_utc = datetime.now().utcnow()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue