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
Mattia Rizzolo
nm.debian.org
Commits
0ba7ac2a
Commit
0ba7ac2a
authored
Apr 21, 2020
by
Enrico Zini
Browse files
Reproduced in test suite. refs:
#9
parent
1758473f
Changes
2
Hide whitespace changes
Inline
Side-by-side
wizard/tests/test_newproc.py
0 → 100644
View file @
0ba7ac2a
from
__future__
import
annotations
from
django.test
import
TestCase
from
django.urls
import
reverse
from
backend.unittest
import
PersonFixtureMixin
from
backend
import
const
from
signon.models
import
Identity
class
NewProcTests
(
PersonFixtureMixin
,
TestCase
):
@
classmethod
def
__add_extra_tests__
(
cls
):
targets
=
[
"dm"
,
"ga"
,
"return"
,
"invalid"
]
targets
.
extend
(
const
.
ALL_STATUS_DESCS
.
keys
())
for
target
in
targets
:
cls
.
_add_method
(
cls
.
_test_notlogged
,
target
)
cls
.
_add_method
(
cls
.
_test_active_unbound
,
target
)
def
_test_notlogged
(
self
,
target
):
# Check that the new person is listed on the page
client
=
self
.
make_test_client
(
None
)
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
target
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"This wizard only works when you are logged into the site"
)
def
_test_active_unbound
(
self
,
target
):
# Check that the new person is listed on the page
identity
=
Identity
.
objects
.
create
(
issuer
=
"debsso"
,
subject
=
"test@debian.org"
,
username
=
"test@debian.org"
,
audit_skip
=
True
)
client
=
self
.
make_test_client
(
None
,
[
identity
])
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
target
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
"This wizard only works when you are logged into the site"
)
def
test_dc_to_dm
(
self
):
client
=
self
.
make_test_client
(
self
.
persons
.
dc
)
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
"dm"
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTrue
(
response
.
context
[
"allowed"
])
self
.
assertContains
(
response
,
"and follow the instructions"
)
def
test_dcga_to_dm
(
self
):
client
=
self
.
make_test_client
(
self
.
persons
.
dc_ga
)
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
"dm"
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTrue
(
response
.
context
[
"allowed"
])
self
.
assertContains
(
response
,
"and follow the instructions"
)
def
test_dm_to_dm
(
self
):
client
=
self
.
make_test_client
(
self
.
persons
.
dm
)
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
"dm"
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertFalse
(
response
.
context
[
"allowed"
])
self
.
assertNotContains
(
response
,
"and follow the instructions"
)
self
.
assertContains
(
response
,
"You are already a Debian Maintainer"
)
def
test_dmga_to_dm
(
self
):
client
=
self
.
make_test_client
(
self
.
persons
.
dm_ga
)
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
"dm"
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertFalse
(
response
.
context
[
"allowed"
])
self
.
assertNotContains
(
response
,
"and follow the instructions"
)
self
.
assertContains
(
response
,
"You are already a Debian Maintainer"
)
def
test_ddnu_to_dm
(
self
):
client
=
self
.
make_test_client
(
self
.
persons
.
dd_nu
)
response
=
client
.
get
(
reverse
(
'wizard_newprocess'
,
args
=
[
"dm"
]))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertFalse
(
response
.
context
[
"allowed"
])
self
.
assertNotContains
(
response
,
"and follow the instructions"
)
self
.
assertContains
(
response
,
"You are already"
)
wizard/tests/test_whoami.py
View file @
0ba7ac2a
from
__future__
import
annotations
from
__future__
import
annotations
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.urls
import
reverse
from
django.urls
import
reverse
from
backend
import
const
from
backend.unittest
import
PersonFixtureMixin
from
backend.unittest
import
PersonFixtureMixin
from
signon.models
import
Identity
from
signon.models
import
Identity
...
...
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