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
SRCT
roomlist
Commits
c240b180
Commit
c240b180
authored
Dec 23, 2016
by
Daniel W Bond
Browse files
created test cases for peoplefinder lookup in cas_callback
parent
f6815539
Changes
1
Show whitespace changes
Inline
Side-by-side
roomlist/accounts/test_views.py
View file @
c240b180
# standard library imports
# standard library imports
from
__future__
import
absolute_import
,
print_function
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
# core django imports
# core django imports
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test
import
Client
from
django.test
import
Client
...
@@ -9,8 +9,47 @@ from django.contrib.auth.models import User
...
@@ -9,8 +9,47 @@ from django.contrib.auth.models import User
from
.models
import
Student
,
Major
,
Confirmation
from
.models
import
Student
,
Major
,
Confirmation
from
housing.models
import
Room
,
Floor
from
housing.models
import
Room
,
Floor
from
housing.test_views
import
RoomlistViewTest
from
housing.test_views
import
RoomlistViewTest
from
.cas_callbacks
import
pfinfo
# peoplefinder lookup tests
# these specific examples will eventually have to change
class
PeoplefinderTest
(
TestCase
):
# presently enrolled student who has been added to peoplefinder
def
test_pf_peoplefinder_method
(
self
):
username
=
'dhaynes'
pf_data
=
pfinfo
(
username
)
print
(
pf_data
)
self
.
assertEqual
(
pf_data
[
0
],
[
'David'
,
'Haynes'
])
self
.
assertEqual
(
pf_data
[
1
],
'CYSE'
)
# student no longer in peoplefinder, or who hasn't yet been added
def
test_pf_ldap_method
(
self
):
username
=
'lfaraone'
pf_data
=
pfinfo
(
username
)
print
(
pf_data
)
self
.
assertEqual
(
pf_data
[
0
],
[
'Luke W'
,
'Faraone'
])
self
.
assertEqual
(
pf_data
[
1
],
''
)
# student employees will have their staff info return before their student info
def
test_pf_employee_method
(
self
):
username
=
'nander13'
pf_data
=
pfinfo
(
username
)
print
(
pf_data
)
self
.
assertEqual
(
pf_data
[
0
],
[
'Nicholas'
,
'Anderson'
])
self
.
assertEqual
(
pf_data
[
1
],
'Undeclared'
)
# a name not found for either (should never happen, but gracefully handle anyway)
def
test_pf_dne
(
self
):
username
=
'bobama'
pf_data
=
pfinfo
(
username
)
print
(
pf_data
)
self
.
assertEqual
(
pf_data
[
0
],
[
''
,
''
])
self
.
assertEqual
(
pf_data
[
1
],
''
)
# view tests
class
ListMajorsTest
(
RoomlistViewTest
):
class
ListMajorsTest
(
RoomlistViewTest
):
def
test_list_majors_ok
(
self
):
def
test_list_majors_ok
(
self
):
...
...
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