From 80b465e0ac1aec23c05f2cd7e780e0587cb10c97 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 16 Jul 2016 13:07:30 -0400 Subject: [PATCH] Tests: Added 'dom.active.json' tests --- test/dom.t | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/dom.t b/test/dom.t index c14ac465..a59c1b81 100755 --- a/test/dom.t +++ b/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())