def test_checkBill(self): self.createBill() QiwiSoapClient.url = 'http://127.0.0.1:{0}/checkBill?wsdl'.format(MockQiwiProviderRunner.PORT) response_expected = { 'user': self.bill_data['user'], 'amount': str(self.bill_data['amount']), 'date': BILLING_DATE, 'lifetime': QiwiSoapClient.hours_to_lifetime(QIWI_BILL_LIFETIME), 'status': Bill.STATUS.MADE } response = QiwiSoapClient.checkBill(txn=self.bill_data['txn']) self.assertDictContainsSubset(response_expected, response)
def update_bill(self, login=QIWI_LOGIN, password='******', txn=None, status=Bill.STATUS.PAYED, amount=None): service = UpdateBillService() check_bill_mock = Mock() BILLING_DATE='10.01.2012 13:00:00' check_bill_mock.return_value = { 'user': '******', 'amount': amount if amount else self.invoice.money_amount.amount, 'date': BILLING_DATE, 'lifetime': QiwiSoapClient.hours_to_lifetime(QIWI_BILL_LIFETIME), 'status': status } service.check_bill = check_bill_mock return service.update_bill( login=login, password=password, txn=txn if txn else self.invoice.uid, status=status )
def test_cancelBill(self): QiwiSoapClient.url = 'http://127.0.0.1:{0}/cancelBill?wsdl'.format(MockQiwiProviderRunner.PORT) response = QiwiSoapClient.cancelBill(txn=self.bill_data['txn']) self.assertEquals(TERMINATION_CODES.SUCCESS, response) self.assertEquals(self.bill_data['txn'], RECEIVED_DATA['cancelBill']['txn'])
def createBill(self): QiwiSoapClient.url = 'http://127.0.0.1:{0}/createBill?wsdl'.format(MockQiwiProviderRunner.PORT) return QiwiSoapClient.createBill(**self.bill_data)
def check_bill(self, txn): return QiwiSoapClient.checkBill(txn=txn)