Tests: Added 'dom.active.json' tests

This commit is contained in:
Paul Beckingham 2016-07-16 13:07:30 -04:00
parent d11caf74f7
commit 80b465e0ac

View file

@ -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())