Exemplo n.º 1
0
 def test_1_sync_with_mangopay_records_exchange_success(self):
     with mock.patch('liberapay.billing.transactions.record_exchange_result') as rer:
         rer.side_effect = Foobar()
         with self.assertRaises(Foobar):
             charge(self.db, self.janet_route, PAYIN_CARD_MIN, 'http://localhost/')
     exchange = self.db.one("SELECT * FROM exchanges")
     assert exchange.status == 'pre'
     sync_with_mangopay(self.db)
     exchange = self.db.one("SELECT * FROM exchanges")
     assert exchange.status == 'succeeded'
     assert Participant.from_username('janet').balance == PAYIN_CARD_MIN
 def test_sync_with_mangopay(self):
     with mock.patch(
             'liberapay.billing.exchanges.record_exchange_result') as rer:
         rer.side_effect = Foobar()
         with self.assertRaises(Foobar):
             charge(self.db, self.janet, D('10.00'), 'http://localhost/')
     exchange = self.db.one("SELECT * FROM exchanges")
     assert exchange.status == 'pre'
     sync_with_mangopay(self.db)
     exchange = self.db.one("SELECT * FROM exchanges")
     assert exchange.status == 'succeeded'
     assert Participant.from_username('janet').balance == 10
Exemplo n.º 3
0
 def test_4_sync_with_mangopay_records_transfer_success(self):
     self.make_exchange('mango-cc', 10, 0, self.janet)
     with mock.patch('liberapay.billing.transactions.record_transfer_result') as rtr:
         rtr.side_effect = Foobar()
         with self.assertRaises(Foobar):
             transfer(self.db, self.janet.id, self.david.id, EUR('10.00'), 'tip')
     t = self.db.one("SELECT * FROM transfers")
     assert t.status == 'pre'
     sync_with_mangopay(self.db)
     t = self.db.one("SELECT * FROM transfers")
     assert t.status == 'succeeded'
     assert Participant.from_username('david').balance == 10
     assert Participant.from_username('janet').balance == 0