def test_reorder(self, mock_index, mock_auto): """Verify items can be reordered.""" path = os.path.join(self.document.path, 'index.yml') common.touch(path) # Act self.document.reorder() # Assert mock_index.assert_called_once_with(self.document, path) mock_auto.assert_called_once_with(self.document.items, start=None, keep=None)
def _create(path, name): # pragma: no cover (integration test) """Create a new file for the object. :param path: path to new file :param name: humanized name for this file :raises: :class:`~doorstop.common.DoorstopError` if the file already exists """ if os.path.exists(path): raise DoorstopError("{} already exists: {}".format(name, path)) common.create_dirname(path) common.touch(path)
def setUp(self): # Create a temporary mock working copy self.cwd = os.getcwd() self.temp = tempfile.mkdtemp() os.chdir(self.temp) common.touch('.mockvcs') # Create default document attributes self.prefix = 'PREFIX' self.root = self.temp self.path = os.path.join(self.root, 'DIRECTORY') self.parent = 'PARENT_PREFIX' # Create default item attributes self.uid = 'PREFIX-00042' # Load an actual document self.document = core.Document(FILES, root=ROOT) # Ensure the tree is reloaded _clear_tree()
def setUp(self): super().setUp() os.chdir(self.temp) common.touch('.mockvcs') _clear_tree()