Merge lp:~ralsina/ubuntuone-client/verify-harder into lp:ubuntuone-client

Proposed by Roberto Alsina on 2012-08-06
Status: Merged
Approved by: Alejandro J. Cura on 2012-08-06
Approved revision: 1292
Merged at revision: 1286
Proposed branch: lp:~ralsina/ubuntuone-client/verify-harder
Merge into: lp:ubuntuone-client
Diff against target: 54 lines (+17/-2)
2 files modified
tests/syncdaemon/test_vm.py (+13/-2)
ubuntuone/syncdaemon/volume_manager.py (+4/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-client/verify-harder
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve on 2012-08-06
Eric Casteleijn (community) 2012-08-06 Approve on 2012-08-06
Review via email: mp+118399@code.launchpad.net

Commit message

 - Added check for UDF path not being a file (LP:1033582).

Description of the change

 - Added check for UDF path not being a file (LP:1033582).

To post a comment you must log in.
Eric Casteleijn (thisfred) wrote :

+2

review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Alejandro J. Cura (alecu) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/syncdaemon/test_vm.py'
--- tests/syncdaemon/test_vm.py 2012-04-09 20:07:05 +0000
+++ tests/syncdaemon/test_vm.py 2012-08-06 19:21:20 +0000
@@ -2752,7 +2752,7 @@
27522752
2753 result, msg = self.vm.validate_path_for_folder(folder_path)2753 result, msg = self.vm.validate_path_for_folder(folder_path)
2754 self.assertTrue(result)2754 self.assertTrue(result)
2755 self.assertIs(msg, "", 2755 self.assertIs(msg, "",
2756 '%r must be a valid path for creating a folder.' % folder_path)2756 '%r must be a valid path for creating a folder.' % folder_path)
27572757
2758 def test_validate_UDF_path_if_folder_shares_a_prefix_with_an_udf(self):2758 def test_validate_UDF_path_if_folder_shares_a_prefix_with_an_udf(self):
@@ -2769,7 +2769,7 @@
27692769
2770 result, msg = self.vm.validate_path_for_folder(tricky_path)2770 result, msg = self.vm.validate_path_for_folder(tricky_path)
2771 self.assertTrue(result)2771 self.assertTrue(result)
2772 self.assertIs(msg, "", 2772 self.assertIs(msg, "",
2773 '%r must be a valid path for creating a folder.' % tricky_path)2773 '%r must be a valid path for creating a folder.' % tricky_path)
27742774
2775 def test_validate_UDF_path_not_valid_if_outside_home(self):2775 def test_validate_UDF_path_not_valid_if_outside_home(self):
@@ -2818,6 +2818,17 @@
2818 self.assertIsNot(msg, "",2818 self.assertIsNot(msg, "",
2819 '%r must be an invalid path for creating a folder.' % udf_parent)2819 '%r must be an invalid path for creating a folder.' % udf_parent)
28202820
2821 def test_not_valid_if_folder_is_file(self):
2822 """A link path is not valid."""
2823 self.patch(volume_manager.os.path, 'isdir', lambda p: False)
2824 self.patch(volume_manager, 'path_exists', lambda p: True)
2825 path_link = os.path.join(self.home_dir, 'Test Me')
2826
2827 result, msg = self.vm.validate_path_for_folder(path_link)
2828 self.assertFalse(result)
2829 self.assertIsNot(msg, "",
2830 '%r must be an invalid path for creating a folder.' % path_link)
2831
2821 def test_not_valid_if_folder_is_link(self):2832 def test_not_valid_if_folder_is_link(self):
2822 """A link path is not valid."""2833 """A link path is not valid."""
2823 self.patch(volume_manager, 'is_link', lambda p: True)2834 self.patch(volume_manager, 'is_link', lambda p: True)
28242835
=== modified file 'ubuntuone/syncdaemon/volume_manager.py'
--- ubuntuone/syncdaemon/volume_manager.py 2012-05-14 21:24:24 +0000
+++ ubuntuone/syncdaemon/volume_manager.py 2012-08-06 19:21:20 +0000
@@ -1207,6 +1207,10 @@
1207 if is_link(path):1207 if is_link(path):
1208 return (False, "UDFs can not be a symlink")1208 return (False, "UDFs can not be a symlink")
12091209
1210 # check if path exists but is not a directory
1211 if path_exists(path) and not os.path.isdir(path):
1212 return (False, "The path exists but is not a folder")
1213
1210 # check if the path it's ok (outside root and1214 # check if the path it's ok (outside root and
1211 # isn't a ancestor or child of another UDF)1215 # isn't a ancestor or child of another UDF)
1212 if self._is_nested_udf(path):1216 if self._is_nested_udf(path):

Subscribers

People subscribed via source and target branches