def test_list(self):
        with mock.patch('paystackapi.transaction.Transaction.list') as \
                mock_list:
                mock_list.return_value = {
                    'status': True
                }

                response = Transaction.list()
                self.assertTrue(response['status'])
Ejemplo n.º 2
0
    def test_list(self):
        httpretty.register_uri(
            httpretty.GET,
            "https://api.paystack.co/transaction",
            content_type='text/json',
            body='{"status": true, "contributors": true}',
            status=201,
        )

        response = Transaction.list()
        self.assertTrue(response['status'])
Ejemplo n.º 3
0
    def test_list(self):
        httpretty.register_uri(
            httpretty.GET,
            self.endpoint_url("/transaction"),
            content_type='text/json',
            body='{"status": true, "contributors": true}',
            status=201,
        )

        response = Transaction.list()
        self.assertTrue(response['status'])
    def test_list(self):
        httpretty.register_uri(
            httpretty.GET,
            "https://api.paystack.co/transaction",
            content_type='text/json',
            body='{"status": true, "contributors": true}',
            status=201,
        )

        response = Transaction.list()
        self.assertTrue(response['status'])
Ejemplo n.º 5
0
def get_transactions():
    response = Transaction.list()
    if response["status"]:
        return jsonify({
            "success": True,
            "total": response["meta"]["total"],
            "total_volume": response["meta"]["total_volume"],
            "message": response["message"],
            "transactions": response["data"]
        }), 200
    else:
        return jsonify({
            "success": False,
            "message": response["message"],
        }), 400