Changeset 10037 for main/waeup.kofa
- Timestamp:
- 18 Mar 2013, 10:34:07 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py
r10036 r10037 66 66 return 67 67 68 REQUEST_XML="""\ 68 def test_XMLRPC_post_1(self): 69 REQUEST_XML="""\ 69 70 <?xml version="1.0"?> 70 71 <methodCall> … … 76 77 </params> 77 78 </methodCall>""" 78 79 RESPONSE_XML="""\ 79 RESPONSE_XML="""\ 80 80 <?xml version='1.0'?> 81 81 <methodResponse> … … 87 87 </methodResponse> 88 88 """ 89 90 def test_XMLRPC_post(self):91 89 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 92 self.browser.addHeader('Content-Length', len( self.REQUEST_XML))93 self.browser.post('http://localhost/app', self.REQUEST_XML,90 self.browser.addHeader('Content-Length', len(REQUEST_XML)) 91 self.browser.post('http://localhost/app', REQUEST_XML, 94 92 'text/xml; charset=utf-8') 95 self.assertEqual(self.browser.contents, self.RESPONSE_XML) 93 self.assertEqual(self.browser.contents, RESPONSE_XML) 94 return 96 95 97 96 def test_get_courses_by_session(self): … … 109 108 {'100|CRS1': 'Course 1', '100|COURSE1': 'Unnamed Course'}) 110 109 return 110 111 def test_XMLRPC_post_2(self): 112 self.setup_student(self.student) 113 REQUEST_XML="""\ 114 <?xml version="1.0"?> 115 <methodCall> 116 <methodName>get_courses_by_session</methodName> 117 <params> 118 <param> 119 <value><string>K1000000</string></value> 120 </param> 121 </params> 122 </methodCall>""" 123 RESPONSE_XML="""\ 124 <?xml version='1.0'?> 125 <methodResponse> 126 <params> 127 <param> 128 <value><struct> 129 <member> 130 <name>100|CRS1</name> 131 <value><string>Course 1</string></value> 132 </member> 133 <member> 134 <name>100|COURSE1</name> 135 <value><string>Unnamed Course</string></value> 136 </member> 137 </struct></value> 138 </param> 139 </params> 140 </methodResponse> 141 """ 142 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 143 self.browser.addHeader('Content-Length', len(REQUEST_XML)) 144 self.browser.post('http://localhost/app', REQUEST_XML, 145 'text/xml; charset=utf-8') 146 self.assertEqual(self.browser.contents, RESPONSE_XML) 147 return
Note: See TracChangeset for help on using the changeset viewer.