Unverified Commit 08de3168 authored by David Haynes's avatar David Haynes
Browse files

Finish unit tests for cas_callbacks.py

- thanks :dbond:
- create_user(tree) is not tested (!) this should be something to come
back to maybe -- the thing is test_models.py already does this checking
to ensure users are made correctly
parent 87b5eef0
Pipeline #820 passed with stage
in 1 minute and 31 seconds
......@@ -8,11 +8,47 @@ from django.test import TestCase
from go.cas_callbacks import pfparse, pfinfo, create_user
"""
Test cases for the functions in call_callbacks
Test cases for the functions in call_callbacks.
"""
class CasCallbacksTest(TestCase):
def testpfinfo(self):
print(pfinfo('dhaynes3'))
"""
Presently enrolled student who has been added to peoplefinder
"""
def test_pf_peoplefinder_method(self):
actual = pfinfo('dhaynes3')
expected = ['David', 'Haynes']
self.assertEqual(expected, actual)
self.assertTrue(True)
"""
Test the parsing method to ensure that first and last names are seperated
accordingly and correctly.
"""
def test_pfparse_peoplefinder_method(self):
actual = pfparse("Haynes, David M")
expected = ['David', 'Haynes']
self.assertEqual(expected, actual)
"""
student no longer in peoplefinder, or who hasn't yet been added
"""
def test_pfinfo_ldap_method(self):
actual = pfinfo('lfaraone')
expected = ['Luke W', 'Faraone']
self.assertEqual(expected, actual)
"""
student employees will have their staff info return before their student info
"""
def test_pfinfo_employee_method(self):
actual = pfinfo('nander13')
expected = ['Nicholas', 'Anderson']
self.assertEqual(expected, actual)
"""
a name not found for either (should never happen, but gracefully handle anyway)
"""
def test_pfinfo_dne(self):
actual = pfinfo('bobama')
expected = ['', '']
self.assertEqual(expected, actual)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment