180
180
req.store.add(new_case)
182
182
return {'result': 'ok'}
184
@named_operation(u'edit')
185
def edit_testcase(self, req, suiteid, testid, passmsg, failmsg, default):
187
suite = req.store.find(TestSuite,
188
TestSuite.suiteid == int(suiteid),
189
TestSuite.exercise_id == self.context.id).one()
191
raise NotFound('testsuite')
193
test_case = req.store.find(TestCase,
194
TestCase.suiteid == suite.suiteid,
195
TestCase.testid == int(testid)).one()
196
if test_case is None:
197
raise NotFound('testcase')
199
test_case.passmsg = unicode(passmsg)
200
test_case.failmsg = unicode(failmsg)
201
test_case.default = unicode(default)
203
return {'result': 'ok'}
205
@named_operation(u'edit')
206
def edit_testpart(self, req, suiteid, testid, partid, part_type, test_type,
209
suite = req.store.find(TestSuite,
210
TestSuite.suiteid == int(suiteid),
211
TestSuite.exercise_id == self.context.id).one()
213
raise NotFound('testsuite')
215
test_case = req.store.find(TestCase,
216
TestCase.suiteid == suite.suiteid,
217
TestCase.testid == int(testid)).one()
218
if test_case is None:
219
raise NotFound('testcase')
221
test_part = req.store.find(TestCasePart,
222
TestCasePart.testid == test_case.testid,
223
TestCasePart.partid == int(partid)).one()
224
if test_part is None:
225
raise NotFound('testcasepart')
227
test_part.part_type = unicode(part_type)
228
test_part.test_type = unicode(test_type)
229
test_part.data = unicode(data)
230
test_part.filename = unicode(filename)
232
return {'result': 'ok'}
234
@named_operation(u'edit')
235
def add_testpart(self, req, suiteid, testid, part_type, test_type,
238
suite = req.store.find(TestSuite,
239
TestSuite.suiteid == int(suiteid),
240
TestSuite.exercise_id == self.context.id).one()
242
raise NotFound('testsuite')
244
test_case = req.store.find(TestCase,
245
TestCase.suiteid == suite.suiteid,
246
TestCase.testid == int(testid)).one()
247
if test_case is None:
248
raise NotFound('testcase')
250
test_part = TestCasePart()
251
test_part.part_type = unicode(part_type)
252
test_part.test_type = unicode(test_type)
253
test_part.data = unicode(data)
254
test_part.filename = unicode(filename)
256
test_case.parts.add(test_part)
258
return {'result': 'ok'}