diff options
Diffstat (limited to 'test/test_cucutags.py')
-rw-r--r-- | test/test_cucutags.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/test_cucutags.py b/test/test_cucutags.py new file mode 100644 index 0000000..7ae82ec --- /dev/null +++ b/test/test_cucutags.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- IGNORE:C0111 +from __future__ import absolute_import, print_function, unicode_literals +import os.path +import cucutags +import unittest +import logging + + +class TestCucutags(unittest.TestCase): + def setUp(self): + self.maxDiff = None + self.datadir = os.path.join(os.path.dirname(__file__), "data") + self.session = cucutags.Session(self.datadir) + logging.debug("session = %s", self.session) + + def test_init_session(self): + """Just initialize Session from data in the data + subdirectory.""" + self.assertIsInstance(self.session, cucutags.Session) + + def test_generate_tags(self): + """Generate tags and compare with expected result.""" + tags = [tuple(x[1:]) for x in + self.session.generate_tags(self.datadir)] + expected = [(u'common_steps/app.py', 59), + (u'common_steps/gmenu.py', 12), + (u'common_steps/gmenu.py', 34), + (u'common_steps/app.py', 59), + (u'common_steps/app.py', 17), + (u'common_steps/app.py', 42), + (u'common_steps/app.py', 66), + (u'common_steps/app.py', 59), + (u'common_steps/gmenu.py', 12), + (u'common_steps/gmenu.py', 34), + (u'common_steps/app.py', 66)] + self.assertEqual(tags, expected) + + def test_find_step(self): + step = self.session.get_step(u"Make sure that Empathy is running") + filename = os.path.relpath(step[0], os.path.dirname(__file__)) + self.assertEqual([filename, step[1]], + ["data/common_steps/app.py", 59]) |