Skip to content

Commit

Permalink
added umask handling when checking for file perms (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
ephur authored and retr0h committed Jun 12, 2017
1 parent 25649f7 commit 7759e81
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_config(gilt_config_file):
assert 'lorin.openstack-ansible-modules' == r.name
assert 'lorin.openstack-ansible-modules' == os_split(r.src)[-1]
assert r.dst is None

f = r.files[0]
x = ('.gilt', 'clone', 'lorin.openstack-ansible-modules', '*_manage')
assert x == os_split(f.src)[-4:]
Expand Down Expand Up @@ -198,8 +199,11 @@ def test_makedirs(temp_dir):
d = os.path.join(temp_dir.strpath, 'foo')
assert os.path.isdir(d)

expected = (7 * 64 + 5 * 8 + 5) # Octal 755
assert expected == (os.lstat(d).st_mode & 0o777)
curmask = os.umask(0)
os.umask(curmask)

expected = 0o777 & ~curmask
assert expected == (os.stat(d).st_mode & 0o777)


def test_makedirs_nested_directory(temp_dir):
Expand Down

0 comments on commit 7759e81

Please sign in to comment.