@@ -0,0 +1,1632 @@
+from django.contrib.messages import get_messages%0Afrom django.urls import reverse%0Afrom djmoney.money import Money%0Afrom mock import patch%0A%0Afrom bluebottle.funding.tests.factories import (%0A    DonationFactory, FundingFactory%0A)%0Afrom bluebottle.funding_flutterwave.tests.factories import FlutterwaveBankAccountFactory%0Afrom bluebottle.test.utils import BluebottleAdminTestCase%0A%0Asuccess_response = %7B%0A    'status': 'success',%0A    'data': %7B%0A        'status': 'successful',%0A        'amount': 1000,%0A        'currency': 'NGN'%0A    %7D%0A%7D%0A%0A%0Aclass FlutterwavePaymentAdminTestCase(BluebottleAdminTestCase):%0A    def setUp(self):%0A        super(FlutterwavePaymentAdminTestCase, self).setUp()%0A        bank_account = FlutterwaveBankAccountFactory.create()%0A        funding = FundingFactory.create(bank_account=bank_account)%0A        self.client.force_login(self.superuser)%0A        self.donation = DonationFactory(%0A            amount=Money(10000, 'NGN'),%0A            activity=funding%0A        )%0A%0A    @patch('bluebottle.funding_flutterwave.utils.post', return_value=success_response)%0A    def test_sync_payment(self, flutterwave_post):%0A        sync_url = reverse('admin:funding_donation_sync', args=(self.donation.id,))%0A        response = self.client.get(sync_url)%0A        messages = list(get_messages(response.wsgi_request))%0A        self.donation.refresh_from_db()%0A        self.assertEqual(%0A            messages%5B0%5D.message,%0A            'Generated missing payment')%0A        self.assertEqual(%0A            messages%5B1%5D.message,%0A            'Checked payment status for %7B%7D'.format((self.donation.payment)))%0A        self.assertEqual(self.donation.status, 'succeeded')%0A

Test sync payment