mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Tests: Added 'dom.active.json' tests
This commit is contained in:
parent
d11caf74f7
commit
80b465e0ac
1 changed files with 16 additions and 5 deletions
21
test/dom.t
21
test/dom.t
|
@ -61,17 +61,17 @@ class TestDOM(TestCase):
|
|||
code, out, err = self.t.runError("get dom.NOPE")
|
||||
self.assertIn("DOM reference 'dom.NOPE' is not valid.", err)
|
||||
|
||||
def test_dom_active_inactive(self):
|
||||
"""Test dom.active without an active interval"""
|
||||
code, out, err = self.t("get dom.active")
|
||||
self.assertEqual('0\n', out)
|
||||
|
||||
def test_dom_active_active(self):
|
||||
"""Test dom.active with and with an active interval"""
|
||||
self.t("start foo")
|
||||
code, out, err = self.t("get dom.active")
|
||||
self.assertEqual('1\n', out)
|
||||
|
||||
def test_dom_active_inactive(self):
|
||||
"""Test dom.active with and without an active interval"""
|
||||
code, out, err = self.t("get dom.active")
|
||||
self.assertEqual('0\n', out)
|
||||
|
||||
def test_dom_active_tag_count_inactive(self):
|
||||
"""Test dom.active.tag.count with no active track"""
|
||||
code, out, err = self.t("get dom.active.tag.count")
|
||||
|
@ -150,6 +150,17 @@ class TestDOM(TestCase):
|
|||
code, out, err = self.t("get dom.tag.2")
|
||||
self.assertEqual('two\n', out)
|
||||
|
||||
def test_dom_active_json_inactive(self):
|
||||
"""Test dom.active.json without an active interval"""
|
||||
code, out, err = self.t.runError("get dom.active.json")
|
||||
self.assertIn("DOM reference 'dom.active.json' is not valid.", err)
|
||||
|
||||
def test_dom_active_json_active(self):
|
||||
"""Test dom.active.json with and with an active interval"""
|
||||
self.t("start foo")
|
||||
code, out, err = self.t("get dom.active.json")
|
||||
self.assertRegexpMatches(out, r'{"start":"\d{8}T\d{6}Z","tags":\["foo"\]}')
|
||||
|
||||
if __name__ == "__main__":
|
||||
from simpletap import TAPTestRunner
|
||||
unittest.main(testRunner=TAPTestRunner())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue