Exemple #1
0
 def test_index_tree(self):
     """Verify an HTML index can be created with a tree."""
     path = os.path.join(FILES, 'index2.html')
     mock_tree = MagicMock()
     mock_tree.documents = []
     for prefix in ('SYS', 'HLR', 'LLR', 'HLT', 'LLT'):
         mock_document = MagicMock()
         mock_document.prefix = prefix
         mock_tree.documents.append(mock_document)
     mock_tree.draw = lambda: "(mock tree structure)"
     mock_item = Mock()
     mock_item.uid = 'KNOWN-001'
     mock_item.document = Mock()
     mock_item.document.prefix = 'KNOWN'
     mock_item_unknown = Mock(spec=['uid'])
     mock_item_unknown.uid = 'UNKNOWN-002'
     mock_trace = [
         (None, mock_item, None, None, None),
         (None, None, None, mock_item_unknown, None),
         (None, None, None, None, None),
     ]
     mock_tree.get_traceability = lambda: mock_trace
     # Act
     publisher._index(FILES, index="index2.html", tree=mock_tree)  # pylint: disable=W0212
     # Assert
     self.assertTrue(os.path.isfile(path))
Exemple #2
0
 def test_index_no_files(self):
     """Verify an HTML index is only created when files exist."""
     path = os.path.join(EMPTY, 'index.html')
     # Act
     publisher._index(EMPTY)  # pylint: disable=W0212
     # Assert
     self.assertFalse(os.path.isfile(path))
 def test_index_tree(self):
     """Verify an HTML index can be created with a tree."""
     path = os.path.join(FILES, 'index2.html')
     mock_tree = MagicMock()
     mock_tree.documents = []
     for prefix in ('SYS', 'HLR', 'LLR', 'HLT', 'LLT'):
         mock_document = MagicMock()
         mock_document.prefix = prefix
         mock_tree.documents.append(mock_document)
     mock_tree.draw = lambda: "(mock tree structure)"
     mock_item = Mock()
     mock_item.uid = 'KNOWN-001'
     mock_item.document = Mock()
     mock_item.document.prefix = 'KNOWN'
     mock_item.header = None
     mock_item_unknown = Mock(spec=['uid'])
     mock_item_unknown.uid = 'UNKNOWN-002'
     mock_trace = [
         (None, mock_item, None, None, None),
         (None, None, None, mock_item_unknown, None),
         (None, None, None, None, None),
     ]
     mock_tree.get_traceability = lambda: mock_trace
     # Act
     publisher._index(FILES, index="index2.html", tree=mock_tree)
     # Assert
     self.assertTrue(os.path.isfile(path))
 def test_index_no_files(self):
     """Verify an HTML index is only created when files exist."""
     path = os.path.join(EMPTY, 'index.html')
     # Act
     publisher._index(EMPTY)
     # Assert
     self.assertFalse(os.path.isfile(path))
Exemple #5
0
 def test_index(self):
     """Verify an HTML index can be created."""
     # Arrange
     path = os.path.join(FILES, 'index.html')
     # Act
     publisher._index(FILES)  # pylint: disable=W0212
     # Assert
     self.assertTrue(os.path.isfile(path))
 def test_index(self):
     """Verify an HTML index can be created."""
     # Arrange
     path = os.path.join(FILES, 'index.html')
     # Act
     publisher._index(FILES)
     # Assert
     self.assertTrue(os.path.isfile(path))