Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
7bbd5a8c
Commit
7bbd5a8c
authored
Oct 15, 2013
by
Giorgos Korfiatis
Browse files
astakos: pep8 fixes
parent
361d9464
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/tests/auth.py
View file @
7bbd5a8c
...
...
@@ -256,7 +256,8 @@ class ShibbolethTests(TestCase):
self
.
assertEqual
(
r
.
status_code
,
200
)
# cannot add the same eppn
client
.
set_tokens
(
mail
=
"secondary@shibboleth.gr"
,
remote_user
=
"kpapeppn"
,
client
.
set_tokens
(
mail
=
"secondary@shibboleth.gr"
,
remote_user
=
"kpapeppn"
,
cn
=
"Kostas Papadimitriou"
,
)
r
=
client
.
get
(
ui_url
(
"login/shibboleth?"
),
follow
=
True
)
self
.
assertRedirects
(
r
,
ui_url
(
'landing'
))
...
...
@@ -264,7 +265,8 @@ class ShibbolethTests(TestCase):
self
.
assertEquals
(
existing_user
.
auth_providers
.
count
(),
2
)
# only one allowed by default
client
.
set_tokens
(
mail
=
"secondary@shibboleth.gr"
,
remote_user
=
"kpapeppn2"
,
client
.
set_tokens
(
mail
=
"secondary@shibboleth.gr"
,
remote_user
=
"kpapeppn2"
,
cn
=
"Kostas Papadimitriou"
,
ep_affiliation
=
"affil2"
)
prov
=
auth_providers
.
get_provider
(
'shibboleth'
)
r
=
client
.
get
(
ui_url
(
"login/shibboleth?"
),
follow
=
True
)
...
...
@@ -276,7 +278,8 @@ class ShibbolethTests(TestCase):
client
.
reset_tokens
()
# cannot login with another eppn
client
.
set_tokens
(
mail
=
"kpap@synnefo.org"
,
remote_user
=
"kpapeppninvalid"
,
client
.
set_tokens
(
mail
=
"kpap@synnefo.org"
,
remote_user
=
"kpapeppninvalid"
,
cn
=
"Kostas Papadimitriou"
)
r
=
client
.
get
(
ui_url
(
"login/shibboleth?"
),
follow
=
True
)
self
.
assertFalse
(
r
.
context
[
'request'
].
user
.
is_authenticated
())
...
...
@@ -352,7 +355,8 @@ class ShibbolethTests(TestCase):
r
=
client
.
get
(
ui_url
(
"login/shibboleth?"
),
follow
=
True
)
# try to assign existing shibboleth identifier of another user
client
.
set_tokens
(
mail
=
"kpap_second@shibboleth.gr"
,
remote_user
=
"existingeppn"
,
cn
=
"Kostas Papadimitriou"
)
remote_user
=
"existingeppn"
,
cn
=
"Kostas Papadimitriou"
)
r
=
client
.
get
(
ui_url
(
"login/shibboleth?"
),
follow
=
True
)
self
.
assertContains
(
r
,
"is already in use"
)
...
...
@@ -747,7 +751,6 @@ class TestAuthProviderViews(TestCase):
eppn_user
.
add_auth_provider
(
'shibboleth'
,
'EPPN'
)
tid_user
.
add_auth_provider
(
'shibboleth'
,
TEST_TARGETED_ID1
)
get_user
=
lambda
r
:
r
.
context
[
'request'
].
user
client
=
ShibbolethClient
()
...
...
@@ -757,7 +760,6 @@ class TestAuthProviderViews(TestCase):
self
.
assertEqual
(
eppn_user
.
get_auth_provider
(
'shibboleth'
).
identifier
,
TEST_TARGETED_ID2
)
client
=
ShibbolethClient
()
client
.
set_tokens
(
eppn
=
"EPPN"
,
remote_user
=
TEST_TARGETED_ID1
)
r
=
client
.
get
(
ui_url
(
'login/shibboleth?'
),
follow
=
True
)
...
...
@@ -765,7 +767,6 @@ class TestAuthProviderViews(TestCase):
self
.
assertEqual
(
tid_user
.
get_auth_provider
(
'shibboleth'
).
identifier
,
TEST_TARGETED_ID1
)
@
shibboleth_settings
(
CREATION_GROUPS_POLICY
=
[
'academic-login'
],
AUTOMODERATE_POLICY
=
True
)
@
im_settings
(
IM_MODULES
=
[
'shibboleth'
,
'local'
],
MODERATION_ENABLED
=
True
,
...
...
@@ -796,7 +797,8 @@ class TestAuthProviderViews(TestCase):
# new academic user
self
.
assertFalse
(
academic_users
.
filter
(
email
=
'newuser@synnefo.org'
))
cl_newuser
.
set_tokens
(
remote_user
=
"newusereppn"
,
mail
=
"newuser@synnefo.org"
,
cl_newuser
.
set_tokens
(
remote_user
=
"newusereppn"
,
mail
=
"newuser@synnefo.org"
,
surname
=
"Lastname"
)
r
=
cl_newuser
.
get
(
ui_url
(
'login/shibboleth?'
),
follow
=
True
)
initial
=
r
.
context
[
'signup_form'
].
initial
...
...
snf-astakos-app/astakos/im/views/im.py
View file @
7bbd5a8c
...
...
@@ -457,7 +457,6 @@ def signup(request, template_name='im/signup.html', on_success='index',
form
=
activation_backend
.
get_signup_form
(
provider
,
None
,
**
form_kwargs
)
if
request
.
method
==
'POST'
:
form
=
activation_backend
.
get_signup_form
(
provider
,
...
...
snf-astakos-app/astakos/im/views/target/shibboleth.py
View file @
7bbd5a8c
...
...
@@ -72,8 +72,8 @@ def migrate_eppn_to_remote_id(eppn, remote_id):
pass
pending_users
=
\
PendingThirdPartyUser
.
objects
.
filter
(
third_party_identifier
=
eppn
,
provider
=
'shibboleth'
)
PendingThirdPartyUser
.
objects
.
filter
(
third_party_identifier
=
eppn
,
provider
=
'shibboleth'
)
for
pending
in
pending_users
:
msg
=
"Migrating pending user %s eppn (%s -> %s)"
...
...
@@ -153,7 +153,7 @@ def login(request,
fullname
=
'%s %s'
%
(
first_name
,
last_name
)
if
not
any
([
first_name
,
last_name
])
and
\
settings
.
SHIBBOLETH_REQUIRE_NAME_INFO
:
settings
.
SHIBBOLETH_REQUIRE_NAME_INFO
:
raise
KeyError
(
_
(
astakos_messages
.
SHIBBOLETH_MISSING_NAME
))
except
KeyError
,
e
:
...
...
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