Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
4e579e95
Commit
4e579e95
authored
Jun 02, 2016
by
Enrico Zini
Browse files
Moved more of the assertion checking to ExpectedSets
parent
c2b190c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/unittest.py
View file @
4e579e95
...
@@ -362,6 +362,14 @@ class ExpectedSets(defaultdict):
...
@@ -362,6 +362,14 @@ class ExpectedSets(defaultdict):
if
not
extra
:
return
if
not
extra
:
return
self
.
testcase
.
fail
(
self
.
action_msg
.
format
(
visitor
=
visitor
)
+
" "
+
self
.
issue_msg
.
format
(
problem
=
"has"
,
mismatch
=
", "
.
join
(
sorted
(
extra
))))
self
.
testcase
.
fail
(
self
.
action_msg
.
format
(
visitor
=
visitor
)
+
" "
+
self
.
issue_msg
.
format
(
problem
=
"has"
,
mismatch
=
", "
.
join
(
sorted
(
extra
))))
def
assertMatches
(
self
,
visited
):
for
visitor
in
self
.
visitors
:
visit_perms
=
visited
.
permissions_of
(
self
.
testcase
.
persons
[
visitor
])
self
.
assertEqual
(
visitor
,
visit_perms
)
for
visitor
in
self
.
select_others
(
self
.
testcase
.
persons
):
visit_perms
=
visited
.
permissions_of
(
self
.
testcase
.
persons
[
visitor
]
if
visitor
else
None
)
self
.
assertEmpty
(
visitor
,
visit_perms
)
class
ExpectedPerms
(
object
):
class
ExpectedPerms
(
object
):
"""
"""
...
...
process/tests/test_perms.py
View file @
4e579e95
...
@@ -98,12 +98,7 @@ class TestVisitApplicant(ProcessFixtureMixin, TestCase):
...
@@ -98,12 +98,7 @@ class TestVisitApplicant(ProcessFixtureMixin, TestCase):
if
"app"
not
in
self
.
processes
:
return
if
"app"
not
in
self
.
processes
:
return
# Check process permissions
# Check process permissions
for
visitor
in
perms
.
proc
.
visitors
:
perms
.
proc
.
assertMatches
(
self
.
processes
.
app
)
visit_perms
=
self
.
processes
.
app
.
permissions_of
(
self
.
persons
[
visitor
])
perms
.
proc
.
assertEqual
(
visitor
,
visit_perms
)
for
visitor
in
perms
.
proc
.
select_others
(
self
.
persons
):
visit_perms
=
self
.
processes
.
app
.
permissions_of
(
self
.
persons
[
visitor
]
if
visitor
else
None
)
perms
.
proc
.
assertEmpty
(
visitor
,
visit_perms
)
# Check requirements
# Check requirements
for
req
in
(
"intent"
,
"sc_dmup"
,
"advocate"
,
"keycheck"
,
"am_ok"
):
for
req
in
(
"intent"
,
"sc_dmup"
,
"advocate"
,
"keycheck"
,
"am_ok"
):
...
@@ -112,13 +107,7 @@ class TestVisitApplicant(ProcessFixtureMixin, TestCase):
...
@@ -112,13 +107,7 @@ class TestVisitApplicant(ProcessFixtureMixin, TestCase):
wanted
=
p
.
combine
(
perms
.
proc
)
wanted
=
p
.
combine
(
perms
.
proc
)
requirement
=
pmodels
.
Requirement
.
objects
.
get
(
process
=
self
.
processes
.
app
,
type
=
req
)
requirement
=
pmodels
.
Requirement
.
objects
.
get
(
process
=
self
.
processes
.
app
,
type
=
req
)
for
visitor
in
wanted
.
visitors
:
wanted
.
assertMatches
(
requirement
)
visit_perms
=
requirement
.
permissions_of
(
self
.
persons
[
visitor
])
wanted
.
assertEqual
(
visitor
,
visit_perms
)
for
visitor
in
wanted
.
select_others
(
self
.
persons
):
visit_perms
=
requirement
.
permissions_of
(
self
.
persons
[
visitor
]
if
visitor
else
None
)
wanted
.
assertEmpty
(
visitor
,
visit_perms
)
def
_assign_am
(
self
,
visitor
):
def
_assign_am
(
self
,
visitor
):
pmodels
.
AMAssignment
.
objects
.
create
(
process
=
self
.
processes
.
app
,
am
=
self
.
ams
.
am
,
assigned_by
=
self
.
persons
[
visitor
],
assigned_time
=
now
())
pmodels
.
AMAssignment
.
objects
.
create
(
process
=
self
.
processes
.
app
,
am
=
self
.
ams
.
am
,
assigned_by
=
self
.
persons
[
visitor
],
assigned_time
=
now
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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