def test_status_timeout(self): balance = 100.00 error = (1,u'Временная ошибка. Повторите запрос позже',False) def callback(): return {'balance':balance, 'error_code':error[0]} pegas = PegasPaymentGateway({}, {'status':callback}) response = \ u""" <?xml version="1.0" encoding="UTF-8"?> <response> <result>%(error)d</result> <comment>%(comment)s</comment> </response>""" % {'error':error[0], 'comment':error[1]} self.assertEquals(pegas.status(), (response, error))
def test_status_ok(self): balance = 100.00 error = (0,u'ОК',False) def callback(): return {'balance':balance, 'error_code':error[0]} pegas = PegasPaymentGateway({}, {'status':callback}) response = \ u""" <?xml version="1.0" encoding="UTF-8"?> <response> <result>%(error)d</result> <balance>%(ballance).02f</balance> </response>""" % {'error':error[0], 'ballance':balance} self.assertEquals(pegas.status(), (response, error))