source: main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_webservices.py @ 10505

Last change on this file since 10505 was 10503, checked in by uli, 11 years ago

Add XMLRPC method to check applicant credentials (tests included).

File size: 1.4 KB
Line 
1# Tests for applicant webservices
2from zope.app.testing.xmlrpc import ServerProxy
3from waeup.kofa.testing import FunctionalLayer
4from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
5
6
7class XMLRPCTests(ApplicantsFullSetup):
8    # check XMLRPC services for university portal
9
10    layer = FunctionalLayer
11
12    def setup_applicant(self, applicant):
13        applicant.firstname = u'Bob'
14        applicant.lastname = u'Bubble'
15        applicant.email = 'bob@sample.com'
16        pass
17
18    def test_check_applicant_credentials_valid(self):
19        # make sure we can get applicant infos providing valid creds
20        server = ServerProxy('http://mgr:mgrpw@localhost/app')
21        self.setup_applicant(self.applicant)
22        apl_id = self.applicant.applicant_id
23        result = server.check_applicant_credentials(apl_id, 'apwd')
24        self.assertEqual(
25            result, {
26                'description': 'Bob Bubble',
27                'email': 'bob@sample.com',
28                'id': apl_id,
29                'type': 'applicant'}
30            )
31        return
32
33    def test_check_applicant_credentials_invalid(self):
34        # invalid creds will give no results
35        server = ServerProxy('http://mgr:mgrpw@localhost/app')
36        self.setup_applicant(self.applicant)
37        apl_id = self.applicant.applicant_id
38        result = server.check_applicant_credentials(apl_id, 'wrong-pw')
39        self.assertEqual(result, None)
40        return
Note: See TracBrowser for help on using the repository browser.