Ejemplo n.º 1
0
 def test_new_cache(self):
     """Verify new items are cached."""
     mock_tree = Mock()
     mock_tree._item_cache = {}
     item = MockItem.new(
         mock_tree, MockSimpleDocument(), EMPTY, FILES, 'TEST00042', level=(1, 2, 3)
     )
     self.assertEqual(item, mock_tree._item_cache[item.uid])
     mock_tree.vcs.add.assert_called_once_with(item.path)
Ejemplo n.º 2
0
 def test_new_special(self):
     """Verify items can be created with a specially named prefix."""
     MockItem._create.reset_mock()
     item = MockItem.new(
         None, MockSimpleDocument(), EMPTY, FILES, 'VSM.HLR_01-002-042', level=(1, 0)
     )
     path = os.path.join(EMPTY, 'VSM.HLR_01-002-042.yml')
     self.assertEqual(path, item.path)
     self.assertEqual((1,), item.level)
     MockItem._create.assert_called_once_with(path, name='item')
Ejemplo n.º 3
0
 def test_new(self):
     """Verify items can be created."""
     MockItem._create.reset_mock()
     item = MockItem.new(
         None, MockSimpleDocument(), EMPTY, FILES, 'TEST00042', level=(1, 2, 3)
     )
     path = os.path.join(EMPTY, 'TEST00042.yml')
     self.assertEqual(path, item.path)
     self.assertEqual((1, 2, 3), item.level)
     MockItem._create.assert_called_once_with(path, name='item')
Ejemplo n.º 4
0
 def setUp(self):
     path = os.path.join('path', 'to', 'RQ001.yml')
     self.item = MockItem(MockSimpleDocument(), path)