source: main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py @ 16376

Last change on this file since 16376 was 16330, checked in by Henrik Bettermann, 4 years ago

Adjust tests.

  • Property svn:keywords set to Id
File size: 25.5 KB
Line 
1## $Id: tests.py 16330 2020-11-22 15:48:00Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18import os
19from datetime import datetime, date, timedelta
20from zope.component import createObject, getUtility
21from zope.catalog.interfaces import ICatalog
22from hurry.workflow.interfaces import IWorkflowState
23from waeup.kofa.students.tests.test_browser import StudentsFullSetup
24from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
25from waeup.uniben.configuration import CustomSessionConfiguration
26from waeup.uniben.testing import FunctionalLayer
27
28# Also run tests that send requests to external servers?
29#   If you enable this, please make sure the external services
30#   do exist really and are not bothered by being spammed by a test programme.
31EXTERNAL_TESTS = False
32
33SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
34
35def external_test(func):
36    if not EXTERNAL_TESTS:
37        myself = __file__
38        if myself.endswith('.pyc'):
39            myself = myself[:-2]
40        print "WARNING: external tests are skipped!"
41        print "WARNING: edit %s to enable them." % myself
42        return
43    return func
44
45
46class InterswitchTestsStudents(StudentsFullSetup):
47    """Tests for the Interswitch payment gateway.
48    """
49
50    layer = FunctionalLayer
51
52    def setUp(self):
53        super(InterswitchTestsStudents, self).setUp()
54        self.app['configuration']['2004'].interswitch_enabled = True
55        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
56        self.browser.open(self.payments_path)
57        IWorkflowState(self.student).setState('cleared')
58        self.student.nationality = u'NG'
59        self.browser.open(self.payments_path + '/addop')
60        self.browser.getControl(name="form.p_category").value = ['schoolfee']
61        self.browser.getControl("Create ticket").click()
62        self.assertMatches('...ticket created...',
63                           self.browser.contents)
64        self.browser.open(self.payments_path)
65        ctrl = self.browser.getControl(name='val_id')
66        self.value = ctrl.options[0]
67        self.browser.getLink(self.value).click()
68        self.assertMatches('...Amount Authorized...',
69                           self.browser.contents)
70        self.assertTrue(
71            '<span>40000.0</span>' in self.browser.contents)
72        self.payment_url = self.browser.url
73
74#    def callback_url(self, payment_url, resp, apprAmt):
75#        return payment_url + (
76#            '/isw_callback?echo=' +
77#            '&resp=%s' +
78#            '&desc=Something went wrong' +
79#            '&txnRef=p1331792385335' +
80#            '&payRef=' + '&retRef=' +
81#            '&cardNum=0' +
82#            '&apprAmt=%s' +
83#            '&url=http://xyz') % (resp, apprAmt)
84
85    def test_interswitch_form(self):
86        # Manager can access InterswitchForm
87        self.browser.getLink("Pay via Interswitch", index=0).click()
88        # The total amount to be processed by Interswitch
89        # has been reduced by the Interswitch fee of 150 Nairas
90        self.assertTrue('<input type="hidden" name="pay_item_id" value="5700" />'
91                           in self.browser.contents)
92        self.assertTrue('Total Amount Authorized:'
93                           in self.browser.contents)
94        self.assertEqual(self.student.current_mode, 'ug_ft')
95        self.assertTrue(
96            '<input type="hidden" name="amount" value="4000000" />'
97            in self.browser.contents)
98        self.assertTrue(
99            'item_name="School Fee" item_amt="3835000" bank_id="8" acct_num="2017506430"'
100            in self.browser.contents)
101        self.assertTrue(
102            'item_name="BT Education" item_amt="150000" bank_id="117" acct_num="1014261520"'
103            in self.browser.contents)
104
105        # Create school fee ticket for returning students. Payment is made
106        # for next session.
107        current_payment_key = self.student['payments'].keys()[0]
108        self.certificate.study_mode = u'ug_pt'
109        IWorkflowState(self.student).setState('returning')
110        configuration = createObject('waeup.SessionConfiguration')
111        configuration.academic_session = 2005
112        self.app['configuration'].addSessionConfiguration(configuration)
113        self.browser.open(self.payments_path + '/addop')
114        self.browser.getControl(name="form.p_category").value = ['schoolfee']
115        self.browser.getControl("Create ticket").click()
116
117        ## Next session payment can't be made ...
118        #self.assertMatches(
119        #    '...You have not yet paid your current/active session...',
120        #    self.browser.contents)
121        ## current session payment must be approved first.
122        #self.student['payments'][current_payment_key].approve()
123        #self.browser.open(self.payments_path + '/addop')
124        #self.browser.getControl(name="form.p_category").value = ['schoolfee']
125        #self.browser.getControl("Create ticket").click()
126
127        self.browser.open(self.payments_path)
128        ctrl = self.browser.getControl(name='val_id')
129        value = ctrl.options[1]
130        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
131        self.assertEqual(self.student['payments'][value].gateway_amt, 0.0)
132        self.browser.getLink(value).click()
133        self.browser.getLink("Pay via Interswitch", index=0).click()
134        # Split amounts have been set.
135        self.assertEqual(self.student['payments'][value].provider_amt, 1500.0)
136        self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
137        self.assertTrue('<input type="hidden" name="pay_item_id" value="5701" />'
138                           in self.browser.contents)
139        self.assertTrue(
140            '<input type="hidden" name="amount" value="2000000" />'
141            in self.browser.contents)
142        self.assertTrue(
143            'item_name="School Fee" item_amt="1835000" bank_id="8" acct_num="2017506430"'
144            in self.browser.contents)
145        self.assertTrue(
146            'item_name="BT Education" item_amt="150000" bank_id="117" acct_num="1014261520"'
147            in self.browser.contents)
148
149        # Create clearance fee ticket
150        #self.browser.open(self.payments_path + '/addop')
151        #self.browser.getControl(name="form.p_category").value = ['clearance']
152        #self.browser.getControl("Create ticket").click()
153        #ctrl = self.browser.getControl(name='val_id')
154        #value = ctrl.options[2]
155        #self.browser.getLink(value).click()
156        #self.assertMatches(
157        #    '...<span>45000.0</span>...',
158        #    self.browser.contents)
159        ## Manager can access InterswitchForm
160        #self.browser.getLink("Pay via Interswitch", index=0).click()
161        #self.assertEqual(self.student['payments'][value].provider_amt, 1500.0)
162        #self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
163        #self.assertMatches('...<input type="hidden" name="pay_item_id" value="5702" />...',
164        #                   self.browser.contents)
165        #self.assertMatches('...Total Amount Authorized:...',
166        #                   self.browser.contents)
167        #self.assertMatches(
168        #    '...<input type="hidden" name="amount" value="4500000.0" />...',
169        #    self.browser.contents)
170        #self.assertMatches(
171        #    '...item_name="Acceptance Fee" item_amt="4335000" bank_id="7" acct_num="1003475516"...',
172        #    self.browser.contents)
173        #self.assertMatches(
174        #    '...item_name="BT Education" item_amt="150000" bank_id="117" acct_num="1010764827"...',
175        #    self.browser.contents)
176
177        # Create gown fee ticket
178        configuration.maint_fee = 987.0
179        self.app['configuration']['2004'].gown_fee = 234.0
180        self.browser.open(self.payments_path + '/addop')
181        self.browser.getControl(name="form.p_category").value = ['gown']
182        self.browser.getControl("Create ticket").click()
183        self.browser.open(self.payments_path)
184        ctrl = self.browser.getControl(name='val_id')
185        value = ctrl.options[2]
186        self.browser.getLink(value).click()
187        self.assertTrue(
188            '<span>234.0</span>',
189            self.browser.contents)
190        # Manager can access InterswitchForm
191        self.browser.getLink("Pay via Interswitch", index=0).click()
192        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
193        self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
194        self.assertTrue('<input type="hidden" name="pay_item_id" value="5704" />'
195                           in self.browser.contents)
196        self.assertTrue('Total Amount Authorized:'
197                           in self.browser.contents)
198        self.assertTrue(
199            '<input type="hidden" name="amount" value="23400" />'
200            in self.browser.contents)
201        self.assertTrue(
202            '<item_detail item_id="1" item_name="Gown Hire Fee" item_amt="8400" bank_id="8" acct_num="2017506430" />'
203            in self.browser.contents)
204        self.assertFalse(
205            'item_name="BT Education"' in self.browser.contents)
206
207        # Create hostel application ticket
208        #self.browser.open(self.payments_path + '/addop')
209        #self.browser.getControl(name="form.p_category").value = ['hostel_application']
210        #self.browser.getControl("Create ticket").click()
211        #ctrl = self.browser.getControl(name='val_id')
212        #value = ctrl.options[3]
213        #self.browser.getLink(value).click()
214        #self.assertTrue(
215        #    '<span>1000.0</span>' in self.browser.contents)
216        #self.student['payments'][value].approve()
217
218        # Create temp maint fee ticket
219        #self.browser.open(self.payments_path + '/addop')
220        #self.browser.getControl(name="form.p_category").value = ['tempmaint_1']
221        #self.browser.getControl("Create ticket").click()
222        #ctrl = self.browser.getControl(name='val_id')
223        #value = ctrl.options[4]
224        #self.browser.getLink(value).click()
225        #self.assertTrue(
226        #    '<span>8150.0</span>' in self.browser.contents)
227        # Manager can access InterswitchForm
228        #self.browser.getLink("Pay via Interswitch", index=0).click()
229        #self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
230        #self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
231        #self.assertTrue('<input type="hidden" name="pay_item_id" value="5705" />'
232        #                 in self.browser.contents)
233        #self.assertMatches('...Total Amount Authorized:...',
234        #                   self.browser.contents)
235        #self.assertTrue(
236        #    '<input type="hidden" name="amount" value="815000" />'
237        #    in self.browser.contents)
238        #self.assertTrue(
239        #    '<item_detail item_id="1" item_name="Hostel Maintenance Fee" item_amt="800000" bank_id="129" acct_num="0014419432" />'
240        #    in self.browser.contents)
241        #self.assertFalse(
242        #    'item_name="BT Education"' in self.browser.contents)
243
244        # Create previous session fee ticket
245        configuration = createObject('waeup.SessionConfiguration')
246        configuration.academic_session = 2003
247        configuration.clearance_fee = 3456.0
248        self.app['configuration'].addSessionConfiguration(configuration)
249        self.student['studycourse'].entry_session = 2002
250        #self.browser.open(self.payments_path + '/addpp')
251        #self.browser.getControl(name="form.p_category").value = ['clearance']
252        #self.browser.getControl(name="form.p_session").value = ['2003']
253        #self.browser.getControl(name="form.p_level").value = ['300']
254        #self.browser.getControl("Create ticket").click()
255        #ctrl = self.browser.getControl(name='val_id')
256        #value = ctrl.options[5]
257        #self.browser.getLink(value).click()
258        #self.assertMatches(
259        #    '...<span>45000.0</span>...',
260        #    self.browser.contents)
261        ## Manager can access InterswitchForm
262        #self.browser.getLink("Pay via Interswitch", index=0).click()
263        #self.assertEqual(self.student['payments'][value].provider_amt, 1500.0)
264        #self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
265        #self.assertMatches('...<input type="hidden" name="pay_item_id" value="5702" />...',
266        #                   self.browser.contents)
267        #self.assertMatches('...Total Amount Authorized:...',
268        #                   self.browser.contents)
269        ##self.assertMatches(
270        #    '...<input type="hidden" name="amount" value="4500000.0" />...',
271        #    self.browser.contents)
272        #self.assertMatches(
273        #    '...<item_detail item_id="1" item_name="Acceptance Fee" item_amt="4335000" bank_id="7" acct_num="1003475516" />...',
274        #    self.browser.contents)
275
276        # Create balance payment ticket
277        self.browser.open(self.payments_path + '/addbp')
278        self.browser.getControl(name="form.p_category").value = ['schoolfee']
279        self.browser.getControl(name="form.balance_session").value = ['2003']
280        self.browser.getControl(name="form.balance_level").value = ['300']
281        self.browser.getControl(name="form.balance_amount").value = '200'
282        self.browser.getControl("Create ticket").click()
283        self.browser.open(self.payments_path)
284        ctrl = self.browser.getControl(name='val_id')
285        value = ctrl.options[3]
286        self.browser.getLink(value).click()
287        self.assertTrue(
288            '<span>200.0</span>' in self.browser.contents)
289        # Manager can access InterswitchForm
290        self.browser.getLink("Pay via Interswitch", index=0).click()
291        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
292        self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
293        self.assertTrue('<input type="hidden" name="pay_item_id" value="5701" />'
294                           in self.browser.contents)
295        self.assertTrue(
296            '<input type="hidden" name="amount" value="20000" />'
297            in self.browser.contents)
298        self.assertTrue(
299            'item_name="School Fee" item_amt="5000" bank_id="8" acct_num="2017506430"'
300            in self.browser.contents)
301        self.assertFalse(
302            'item_name="BT Education"' in self.browser.contents)
303
304        # Create JUPEB fee ticket
305        self.app['configuration']['2004'].jupeb_fee = 345.0
306        self.browser.open(self.payments_path + '/addop')
307        self.browser.getControl(name="form.p_category").value = ['jupeb']
308        self.browser.getControl("Create ticket").click()
309        self.browser.open(self.payments_path)
310        ctrl = self.browser.getControl(name='val_id')
311        value = ctrl.options[4]
312        self.browser.getLink(value).click()
313        self.assertTrue(
314            '<span>345.0</span>',
315            self.browser.contents)
316        # Manager can access InterswitchForm
317        self.browser.getLink("Pay via Interswitch", index=0).click()
318        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
319        self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
320        self.assertTrue('<input type="hidden" name="pay_item_id" value="5717" />'
321                           in self.browser.contents)
322        self.assertTrue('Total Amount Authorized:'
323                           in self.browser.contents)
324        self.assertTrue(
325            '<input type="hidden" name="amount" value="34500" />'
326            in self.browser.contents)
327        self.assertTrue(
328            '<item_detail item_id="1" item_name="JUPEB Examination Fee" item_amt="19500" bank_id="8" acct_num="2017506430" />'
329            in self.browser.contents)
330        self.assertFalse(
331            'item_name="BT Education"' in self.browser.contents)
332
333#    @external_test
334#    def test_callback(self):
335
336        # Manager can call callback manually
337#        self.browser.open(self.callback_url(self.payment_url, 'XX', '300'))
338#        self.assertMatches('...Unsuccessful callback: Something went wrong...',
339#                          self.browser.contents)
340#        self.assertMatches('...Failed...',
341#                           self.browser.contents)
342#        self.browser.open(self.payment_url + '/isw_callback')
343#        self.assertMatches('...Unsuccessful callback: Incomplete query string...',
344#                          self.browser.contents)
345#        self.assertMatches('...Failed...',
346#                           self.browser.contents)
347#        self.browser.open(self.callback_url(self.payment_url, '00', '300000'))
348#        self.assertMatches('...Wrong amount...',
349#                          self.browser.contents)
350#        self.browser.open(self.callback_url(self.payment_url, '00', '4000000'))
351#        self.assertMatches('...Valid callback received...',
352#                          self.browser.contents)
353
354    def test_interswitch_form_ticket_expired(self):
355        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
356        acc_payment = createObject('waeup.StudentOnlinePayment')
357        acc_payment.p_state = 'unpaid'
358        acc_payment.p_category = 'clearance'
359        acc_payment.p_id = 'xyz'
360        acc_payment.pay_item_id = '123'
361        acc_payment.amount_auth = 876.0
362        self.student['payments']['xyz'] = acc_payment
363        self.browser.open(self.payments_path + '/xyz')
364        self.browser.getLink("Pay via Interswitch", index=0).click()
365        self.assertTrue('<input type="hidden" name="pay_item_id" value="5702" />'
366                           in self.browser.contents)
367        self.assertTrue('Total Amount Authorized:'
368                           in self.browser.contents)
369        self.assertEqual(self.student.current_mode, 'ug_ft')
370        self.assertTrue(
371            '<input type="hidden" name="amount" value="87600" />'
372            in self.browser.contents)
373        delta = timedelta(days=8)
374        acc_payment.creation_date -= delta
375        self.browser.open(self.payments_path + '/xyz')
376        self.browser.getLink("Pay via Interswitch", index=0).click()
377        self.assertMatches(
378            '...This payment ticket is too old. Please create a new ticket...',
379            self.browser.contents)
380        delta = timedelta(days=2)
381        acc_payment.creation_date += delta
382        self.browser.open(self.payments_path + '/xyz')
383        self.browser.getLink("Pay via Interswitch", index=0).click()
384        self.assertMatches('...Total Amount Authorized:...',
385                           self.browser.contents)
386
387    def test_pay_twice(self):
388        # Create second ticket
389        self.browser.open(self.payments_path + '/addop')
390        self.browser.getControl(name="form.p_category").value = ['schoolfee']
391        self.browser.getControl("Create ticket").click()
392        self.browser.open(self.payments_path)
393        # Pay first ticket
394        self.student['payments'][self.value].approve()
395        # Try to pay second ticket
396        self.browser.open(self.payments_path)
397        ctrl = self.browser.getControl(name='val_id')
398        value = ctrl.options[1]
399        self.browser.getLink(value).click()
400        self.browser.getLink("Pay via Interswitch", index=0).click()
401        self.assertMatches(
402            '...alert alert-danger">This type of payment has already been made...',
403            self.browser.contents)
404
405    @external_test
406    def test_webservice(self):
407        # First we have open InterswitchPageStudent to set provider_amt
408        # and gateway_amt
409        self.browser.open(self.payment_url + '/goto_interswitch')
410        # Now we can call the webservice
411        self.browser.open(self.payment_url + '/request_webservice')
412        self.assertMatches('...Unsuccessful callback...',
413                          self.browser.contents)
414        # The payment is now in state failed ...
415        self.assertMatches('...<span>Failed</span>...',
416                          self.browser.contents)
417        # ... and the catalog has been updated
418        cat = getUtility(ICatalog, name='payments_catalog')
419        results = list(
420            cat.searchResults(p_state=('failed', 'failed')))
421        self.assertEqual(len(results), 1)
422        self.assertEqual(results[0].p_state, 'failed')
423
424        # Let's replace the p_id with a valid p_id of the Uniben
425        # live system. This is definitely not an appropriate
426        # solution for testing, but we have no choice since
427        # Interswitch doesn't provide any interface
428        # for testing.
429        payment = self.student['payments'][self.value]
430        payment.p_id = 'p3547789850240'
431        self.browser.open(self.payment_url + '/request_webservice')
432        self.assertMatches('...Callback amount does not match...',
433                          self.browser.contents)
434        # The payment is now in state failed ...
435        self.assertMatches('...<span>Failed</span>...',
436                          self.browser.contents)
437        # Let's replace the amount autorized with the amount of the
438        # live system payment
439        payment.amount_auth = payment.r_amount_approved
440        self.browser.open(self.payment_url + '/request_webservice')
441        self.assertMatches('...Successful payment...',
442                          self.browser.contents)
443        # The payment is now in state paid ...
444        self.assertMatches('...<span>Paid</span>...',
445                          self.browser.contents)
446        # ... and the catalog has been updated
447        cat = getUtility(ICatalog, name='payments_catalog')
448        results = list(
449            cat.searchResults(p_state=('paid', 'paid')))
450        self.assertEqual(len(results), 1)
451        self.assertEqual(results[0].p_state, 'paid')
452        # Approval is logged in students.log ...
453        logfile = os.path.join(
454            self.app['datacenter'].storage, 'logs', 'students.log')
455        logcontent = open(logfile).read()
456        self.assertTrue(
457            'zope.mgr - '
458            'waeup.uniben.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageStudent - '
459            'B1000000 - successful schoolfee payment: p3547789850240\n'
460            in logcontent)
461        # ... and in payments.log
462        logfile = os.path.join(
463            self.app['datacenter'].storage, 'logs', 'payments.log')
464        logcontent = open(logfile).read()
465        self.assertTrue(
466            '"zope.mgr",B1000000,p3547789850240,schoolfee,'
467            '12000.0,00,1500.0,150.0,0.0,,,\n'
468            in logcontent)
469
470
471class InterswitchTestsApplicants(ApplicantsFullSetup):
472    """Tests for the Interswitch payment gateway.
473    """
474
475    layer = FunctionalLayer
476
477    def setUp(self):
478        super(InterswitchTestsApplicants, self).setUp()
479        configuration = CustomSessionConfiguration()
480        configuration.academic_session = datetime.now().year - 2
481        configuration.interswitch_enabled = True
482        self.applicantscontainer.application_fee = 1000.0
483        self.app['configuration'].addSessionConfiguration(configuration)
484        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
485        self.browser.open(self.manage_path)
486        #IWorkflowState(self.student).setState('started')
487        super(InterswitchTestsApplicants, self).fill_correct_values()
488        self.browser.getControl("Create and make online").click()
489        self.assertMatches('...passport photo before making payment...',
490                           self.browser.contents)
491        self.browser.open(self.manage_path)
492        super(InterswitchTestsApplicants, self).fill_correct_values()
493        #self.browser.getControl(name="form.nationality").value = ['NG']
494        #self.browser.getControl(name="transition").value = ['start']
495        image = open(SAMPLE_IMAGE, 'rb')
496        ctrl = self.browser.getControl(name='form.passport')
497        file_ctrl = ctrl.mech_control
498        file_ctrl.add_file(image, filename='myphoto.jpg')
499        self.browser.getControl("Save").click()
500        self.browser.getControl("Create and make online").click()
501        self.assertMatches('...ticket created...',
502                           self.browser.contents)
503        #ctrl = self.browser.getControl(name='val_id')
504        #value = ctrl.options[0]
505        #self.browser.getLink(value).click()
506        self.payment_url = self.browser.url
507
508    def test_interswitch_form(self):
509        self.assertMatches('...Amount Authorized...',
510                           self.browser.contents)
511        self.assertTrue(
512            '<span>1000.0</span>' in self.browser.contents)
513        # Manager can access InterswitchForm
514        self.browser.getLink("Pay via Interswitch", index=0).click()
515        self.assertMatches('...Total Amount Authorized:...',
516                           self.browser.contents)
517        self.assertTrue(
518            '<input type="hidden" name="amount" value="100000" />'
519            in self.browser.contents)
520        delta = timedelta(days=8)
521        self.applicant.values()[0].creation_date -= delta
522        self.browser.open(self.payment_url)
523        self.browser.getLink("Pay via Interswitch", index=0).click()
524        self.assertMatches(
525            '...This payment ticket is too old. Please create a new ticket...',
526            self.browser.contents)
527
528    @external_test
529    def test_webservice(self):
530
531        self.browser.open(self.payment_url + '/request_webservice')
532        self.assertMatches('...Unsuccessful callback...',
533                          self.browser.contents)
534        # The payment is now in state failed
535        self.assertMatches('...<span>Failed</span>...',
536                          self.browser.contents)
Note: See TracBrowser for help on using the repository browser.