Ignore:
Timestamp:
3 Feb 2021, 21:26:18 (4 years ago)
Author:
Henrik Bettermann
Message:

Change webservice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py

    r16391 r16392  
    55from cStringIO import StringIO
    66from zope.app.testing.xmlrpc import ServerProxy
    7 from zope.component import getUtility
     7from zope.component import getUtility, createObject
    88from waeup.kofa.interfaces import (
    99    IExtFileStore, IFileStoreNameChooser, IKofaUtils)
     
    1616
    1717class XMLRPCTests(StudentsFullSetup):
    18     # check XMLRPC services for university portal
    1918
    2019    layer = FunctionalLayer
     
    3433        ticket.code = u'CRS1'
    3534        ticket.title = u'Course 1'
    36         ticket.fcode = u'FAC1'
    37         ticket.dcode = u'DEP1'
     35        ticket.fcode = u'fac1'
     36        ticket.dcode = u'dep1'
    3837        ticket.credits = 100
    3938        ticket.passmark = 100
     
    224223
    225224    def test_get_students_by_department(self):
    226         self.setup_student(self.student)
    227         server = ServerProxy('http://mgr:mgrpw@localhost/app')
    228         result = server.get_students_by_department('fac1','dep1', '2012')
    229         self.assertEqual(result, [['COURSE1', 100, 2012, 'K1000000', '234', 'Anna Tester']])
     225        self.course2 = createObject('waeup.Course')
     226        self.course2.code = 'COURSE2'
     227        self.app['faculties']['fac1']['dep1'].courses.addCourse(
     228            self.course2)
     229        self.setup_student(self.student)
     230        ticket = CourseTicket()
     231        ticket.code = u'COURSE2'
     232        ticket.title = u'Course 2'
     233        ticket.fcode = u'fac1'
     234        ticket.dcode = u'fac1'
     235        self.student['studycourse']['100'][ticket.code] = ticket
     236        server = ServerProxy('http://mgr:mgrpw@localhost/app')
     237        result = server.get_students_by_department('fac1','dep1', '2011')
     238        self.assertEqual(result, {})
     239        result = server.get_students_by_department('fac1','dep1', '2012', '200')
     240        self.assertEqual(result, {})
     241        result = server.get_students_by_department('fac1','dep1', '2012', '100')
     242        self.assertEqual(
     243            result, {'K1000000': ['234', 'Anna Tester', ['COURSE1', 'COURSE2']]})
    230244        result = server.get_students_by_department('fac1','dep1')
    231         self.assertEqual(result, [['COURSE1', 100, 2012, 'K1000000', '234', 'Anna Tester']])
     245        self.assertEqual(
     246            result, {'K1000000': ['234', 'Anna Tester', ['COURSE1', 'COURSE2']]})
    232247        result = server.get_students_by_department('fac1','dep2')
    233248        self.assertEqual(result, None)
     
    248263<params>
    249264<param>
     265<value><struct>
     266<member>
     267<name>K1000000</name>
    250268<value><array><data>
     269<value><string>234</string></value>
     270<value><string>Anna Tester</string></value>
    251271<value><array><data>
    252272<value><string>COURSE1</string></value>
    253 <value><int>100</int></value>
    254 <value><int>2012</int></value>
    255 <value><string>K1000000</string></value>
    256 <value><string>234</string></value>
    257 <value><string>Anna Tester</string></value>
     273<value><string>COURSE2</string></value>
    258274</data></array></value>
    259275</data></array></value>
     276</member>
     277</struct></value>
    260278</param>
    261279</params>
Note: See TracChangeset for help on using the changeset viewer.