mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
Added integration test validating umask is properly set on file creation by touch.
Summary: Added integration test validating umask is properly set on file creation by touch. Reviewed By: wez Differential Revision: D6749557 fbshipit-source-id: adb89ec996148ede95bdb23399745b39504ae8db
This commit is contained in:
parent
319b991379
commit
c2eb5f3f3f
@ -107,6 +107,21 @@ class SetAttrTest:
|
|||||||
self.assertGreaterEqual(st.st_atime, now)
|
self.assertGreaterEqual(st.st_atime, now)
|
||||||
self.assertGreaterEqual(st.st_mtime, now)
|
self.assertGreaterEqual(st.st_mtime, now)
|
||||||
|
|
||||||
|
def test_umask(self):
|
||||||
|
original_umask = os.umask(0o177)
|
||||||
|
try:
|
||||||
|
filename = os.path.join(self.mount, 'test1')
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.write('garbage')
|
||||||
|
self.assertEqual(os.stat(filename).st_mode & 0o777, 0o600)
|
||||||
|
filename = os.path.join(self.mount, 'test2')
|
||||||
|
os.umask(0o777)
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.write('garbage')
|
||||||
|
self.assertEqual(os.stat(filename).st_mode & 0o777, 0o000)
|
||||||
|
finally:
|
||||||
|
os.umask(original_umask)
|
||||||
|
|
||||||
def test_dir_addfile(self):
|
def test_dir_addfile(self):
|
||||||
dirname = os.path.join(self.mount, 'test_dir')
|
dirname = os.path.join(self.mount, 'test_dir')
|
||||||
self.mkdir('test_dir')
|
self.mkdir('test_dir')
|
||||||
|
Loading…
Reference in New Issue
Block a user