Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-cas
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-cas
Commits
063d553c
Commit
063d553c
authored
Nov 30, 2010
by
Ed Crewe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sso test
parent
37632248
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
.hgignore
+6
-0
django_cas/tests/cas_tests.py
+17
-7
No files found.
.hgignore
0 → 100644
View file @
063d553c
# use glob syntax.
syntax: glob
.hgignore
*.pyc
*~
django_cas/tests/cas_tests.py
View file @
063d553c
...
...
@@ -119,7 +119,7 @@ class TestCAS(unittest.TestCase):
if
token
:
self
.
auth
[
TOKEN
]
=
token
else
:
print
'FAIL
ED
CSRF Token could not be found on page'
print
'FAIL
:
CSRF Token could not be found on page'
return
ticket
self
.
auth
[
'service'
]
=
APP_URL
data
=
urllib
.
urlencode
(
self
.
auth
)
...
...
@@ -129,9 +129,9 @@ class TestCAS(unittest.TestCase):
sso_resp
.
close
()
if
found
:
ticket
=
self
.
get_ticket
(
sso_page
,
APP_URL
)
print
'PASS CAS logged in to
%
s'
%
url
print
'PASS
:
CAS logged in to
%
s'
%
url
else
:
print
'FAIL
ED CAS
login to
%
s'
%
url
print
'FAIL
: Couldnt
login to
%
s'
%
url
return
ticket
def
get_restricted
(
self
):
...
...
@@ -141,30 +141,40 @@ class TestCAS(unittest.TestCase):
ok
=
app_resp
.
code
==
200
app_resp
.
close
()
if
ok
:
print
'PASS logged in to restricted app at
%
s'
%
url
print
'PASS
:
logged in to restricted app at
%
s'
%
url
else
:
print
'FAIL
ED to
log in to restricted app at
%
s'
%
url
print
'FAIL
: couldnt
log in to restricted app at
%
s'
%
url
return
def
get_proxy_iou
(
self
):
""" Use login ticket to get proxy iou """
url_args
=
(
CAS_URL
,
self
.
ticket
,
APP_URL
,
PROXY_URL
)
url_args
=
(
CAS_
SERVER_
URL
,
self
.
ticket
,
APP_URL
,
PROXY_URL
)
url
=
'
%
s/serviceValidate?ticket=
%
s&service=
%
s&pgtUrl=
%
s'
%
url_args
try
:
iou
=
self
.
opener
.
open
(
url
)
except
:
return
'FAIL: service validate url=
%
s not found'
%
url
page
=
iou
.
read
()
if
page
.
find
(
'cas:authenticationSuccess'
)
>
-
1
:
iou_ticket
=
self
.
find_in_dom
(
page
,[
'cas:serviceResponse'
,
'cas:authenticationSuccess'
,
'cas:proxyGrantingTicket'
])
if
iou_ticket
:
return
iou_ticket
else
:
return
'FAIL: PGIOU Empty response'
else
:
return
'FAIL: PGIOU Response failed authentication'
return
None
def
get_proxy
(
self
,
iou
):
""" Use login ticket to get proxy """
url_args
=
(
PROXY_URL
,
iou
)
url
=
'
%
s/pgtCallback?pgtIou=
%
s'
%
url_args
return
url
try
:
pgt
=
self
.
opener
.
open
(
url
)
except
:
return
'FAIL: PGTURL=
%
s not found'
%
url
page
=
pgt
.
read
()
return
page
if
page
.
find
(
'cas:authenticationSuccess'
)
>
-
1
:
...
...
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