Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Fixed same root rename bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellsayer committed Dec 4, 2019
1 parent 83a4f61 commit 47147a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hybridcontents/hybridmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,6 @@ def rename(self, old_path, new_path):
# Else we are moving within a single ContentManager
assert new_prefix == old_prefix

self._validate_path(new_prefix, new_mgr_path)

return new_mgr.rename(old_mgr_path, new_mgr_path)
11 changes: 11 additions & 0 deletions hybridcontents/tests/test_hybrid_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,17 @@ def test_rename_invalid_path(self):
with assertRaisesHTTPError(self, 405):
cm.rename(old_path, new_path)

def test_rename_invalid_path_same_manager(self):
cm = self.contents_manager

cm.new_untitled(path='A', ext='.txt')

old_path = 'A/Untitled.txt'
new_path = 'A/Untitled2.yaml'

with assertRaisesHTTPError(self, 405):
cm.rename(old_path, new_path)

def test_save_invalid_path(self):
cm = self.contents_manager

Expand Down

0 comments on commit 47147a2

Please sign in to comment.