Exemplo n.º 1
0
 def test_find_ref(self):
     """Verify an item's external reference can be found."""
     item = core.Item(None, os.path.join(FILES, 'REQ003.yml'))
     item.tree = Mock()
     item.tree.vcs = mockvcs.WorkingCopy(FILES)
     path, line = item.find_ref()
     relpath = os.path.relpath(os.path.join(FILES, 'external', 'text.txt'), FILES)
     self.assertEqual(relpath, path)
     self.assertEqual(3, line)
Exemplo n.º 2
0
    def test_find_references(self):
        """Verify an item's external reference can be found."""
        item = core.Item(None, os.path.join(FILES, 'REQ006.yml'), ROOT)
        item.tree = Mock()
        item.tree.vcs = mockvcs.WorkingCopy(FILES)
        item.root = FILES
        ref_items = item.find_references()
        self.assertEqual(len(ref_items), 2)

        path1, keyword_line_1 = ref_items[0]
        relpath1 = os.path.relpath(os.path.join(FILES, 'external', 'text.txt'), FILES)
        self.assertEqual(path1, relpath1)
        self.assertEqual(keyword_line_1, 3)

        path2, keyword_line_2 = ref_items[1]
        relpath2 = os.path.relpath(os.path.join(FILES, 'external', 'text2.txt'), FILES)
        self.assertEqual(path2, relpath2)
        self.assertEqual(keyword_line_2, None)
Exemplo n.º 3
0
 def setUp(self):
     self.path = os.path.join(FILES, 'REQ001.yml')
     self.backup = common.read_text(self.path)
     self.item = core.Item(self.path)
     self.item.tree = Mock()
     self.item.tree.vcs = mockvcs.WorkingCopy(EMPTY)