Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
f6d87faf
Commit
f6d87faf
authored
Feb 27, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: import ansible_helpers_test.
parent
207159cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
ansible_mitogen/helpers.py
ansible_mitogen/helpers.py
+1
-4
tests/ansible_helpers_test.py
tests/ansible_helpers_test.py
+20
-0
No files found.
ansible_mitogen/helpers.py
View file @
f6d87faf
...
...
@@ -190,9 +190,6 @@ CHMOD_BITS = {
}
}
def
or_
(
it
):
return
reduce
(
operator
.
or_
,
it
,
0
)
def
apply_mode_spec
(
spec
,
mode
):
for
clause
in
spec
.
split
(
','
):
...
...
@@ -202,7 +199,7 @@ def apply_mode_spec(spec, mode):
mask
=
CHMOD_MASKS
[
ch
]
bits
=
CHMOD_BITS
[
ch
]
cur_perm_bits
=
mode
&
mask
new_perm_bits
=
or_
(
bits
[
p
]
for
p
in
perms
)
new_perm_bits
=
reduce
(
operator
.
or_
,
(
bits
[
p
]
for
p
in
perms
),
0
)
mode
&=
~
mask
if
op
==
'='
:
mode
|=
new_perm_bits
...
...
tests/ansible_helpers_test.py
0 → 100644
View file @
f6d87faf
import
unittest2
import
ansible_mitogen.helpers
import
testlib
class
ApplyModeSpecTest
(
unittest2
.
TestCase
):
func
=
staticmethod
(
ansible_mitogen
.
apply_mode_spec
)
def
test_simple
(
self
):
spec
=
'u+rwx,go=x'
self
.
assertEquals
(
0711
,
self
.
func
(
spec
,
0
))
spec
=
'g-rw'
self
.
assertEquals
(
0717
,
self
.
func
(
spec
,
0777
))
if
__name__
==
'__main__'
:
unittest2
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment