Changeset 17787 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 15 May 2024, 06:42:58 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py
r16393 r17787 1111 1111 self.assertEqual(xmlout, RESPONSE_XML) 1112 1112 return 1113 1114 def test_get_student_info(self): 1115 server = ServerProxy('http://mgr:mgrpw@localhost/app') 1116 self.setup_student(self.student) 1117 result = server.get_student_info('123') 1118 self.assertEqual(result, 1119 ['Anna Tester', 'CERT1', '1234', 'aa@aa.ng']) 1120 REQUEST_XML = """\ 1121 <?xml version="1.0"?> 1122 <methodCall> 1123 <methodName>get_student_info</methodName> 1124 <params> 1125 <param> 1126 <value><string>K1000000</string></value> 1127 </param> 1128 </params> 1129 </methodCall>""" 1130 RESPONSE_XML = """\ 1131 <?xml version='1.0'?> 1132 <methodResponse> 1133 <params> 1134 <param> 1135 <value><array><data> 1136 <value><string>Anna Tester</string></value> 1137 <value><string>CERT1</string></value> 1138 <value><string>1234</string></value> 1139 <value><string>aa@aa.ng</string></value> 1140 </data></array></value> 1141 </param> 1142 </params> 1143 </methodResponse> 1144 """ 1145 xmlout = self.XMLRPC_post(REQUEST_XML) 1146 self.assertEqual(xmlout, RESPONSE_XML) 1147 return 1148 1149 def test_get_student_base_data(self): 1150 server = ServerProxy('http://mgr:mgrpw@localhost/app') 1151 result = server.get_student_base_data() 1152 self.assertEqual(result, 1153 [{'entry_mode': None, 1154 'reg_number': '123', 1155 'firstname': 'Anna', 1156 'middlename': None, 1157 'current_session': 2004, 1158 'entry_session': 2004, 1159 'certcode': 'CERT1', 1160 'state': 'created', 1161 'student_id': 'K1000000', 1162 'faccode': 'fac1', 1163 'lastname': 'Tester', 1164 'matric_number': '234', 1165 'depcode': 'dep1'}]) 1166 REQUEST_XML = """\ 1167 <?xml version="1.0"?> 1168 <methodCall> 1169 <methodName>get_student_base_data</methodName> 1170 <params> 1171 </params> 1172 </methodCall>""" 1173 RESPONSE_XML = """\ 1174 <?xml version='1.0'?> 1175 <methodResponse> 1176 <params> 1177 <param> 1178 <value><array><data> 1179 <value><struct> 1180 <member> 1181 <name>entry_mode</name> 1182 <value><nil/></value></member> 1183 <member> 1184 <name>reg_number</name> 1185 <value><string>123</string></value> 1186 </member> 1187 <member> 1188 <name>firstname</name> 1189 <value><string>Anna</string></value> 1190 </member> 1191 <member> 1192 <name>middlename</name> 1193 <value><nil/></value></member> 1194 <member> 1195 <name>current_session</name> 1196 <value><int>2004</int></value> 1197 </member> 1198 <member> 1199 <name>entry_session</name> 1200 <value><int>2004</int></value> 1201 </member> 1202 <member> 1203 <name>certcode</name> 1204 <value><string>CERT1</string></value> 1205 </member> 1206 <member> 1207 <name>matric_number</name> 1208 <value><string>234</string></value> 1209 </member> 1210 <member> 1211 <name>state</name> 1212 <value><string>created</string></value> 1213 </member> 1214 <member> 1215 <name>faccode</name> 1216 <value><string>fac1</string></value> 1217 </member> 1218 <member> 1219 <name>lastname</name> 1220 <value><string>Tester</string></value> 1221 </member> 1222 <member> 1223 <name>student_id</name> 1224 <value><string>K1000000</string></value> 1225 </member> 1226 <member> 1227 <name>depcode</name> 1228 <value><string>dep1</string></value> 1229 </member> 1230 </struct></value> 1231 </data></array></value> 1232 </param> 1233 </params> 1234 </methodResponse> 1235 """ 1236 xmlout = self.XMLRPC_post(REQUEST_XML) 1237 self.assertEqual(xmlout, RESPONSE_XML) 1238 return
Note: See TracChangeset for help on using the changeset viewer.