From 5c8470e552b45a380106cb0e7bc9b8869e84f74b Mon Sep 17 00:00:00 2001 From: Daniel Reed Date: Sat, 30 Dec 2017 04:48:38 -0800 Subject: [PATCH] Store bot in PreCheckoutQuery (#953) Fixes #937 --- AUTHORS.rst | 1 + telegram/payment/precheckoutquery.py | 2 +- tests/test_precheckoutquery.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 9f0f86d66..7e3e48681 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -22,6 +22,7 @@ The following wonderful people contributed directly or indirectly to this projec - `bimmlerd `_ - `d-qoi `_ - `daimajia `_ +- `Daniel Reed `_ - `Eli Gao `_ - `ErgoZ Riftbit Vaper `_ - `Eugene Lisitsky `_ diff --git a/telegram/payment/precheckoutquery.py b/telegram/payment/precheckoutquery.py index 0ca320b4f..e08d5dcdf 100644 --- a/telegram/payment/precheckoutquery.py +++ b/telegram/payment/precheckoutquery.py @@ -87,7 +87,7 @@ class PreCheckoutQuery(TelegramObject): data['from_user'] = User.de_json(data.pop('from'), bot) data['order_info'] = OrderInfo.de_json(data.get('order_info'), bot) - return cls(**data) + return cls(bot=bot, **data) def to_dict(self): data = super(PreCheckoutQuery, self).to_dict() diff --git a/tests/test_precheckoutquery.py b/tests/test_precheckoutquery.py index ce66deed3..ba248e3ee 100644 --- a/tests/test_precheckoutquery.py +++ b/tests/test_precheckoutquery.py @@ -55,6 +55,7 @@ class TestPreCheckoutQuery(object): } pre_checkout_query = PreCheckoutQuery.de_json(json_dict, bot) + assert pre_checkout_query.bot is bot assert pre_checkout_query.id == self.id assert pre_checkout_query.invoice_payload == self.invoice_payload assert pre_checkout_query.shipping_option_id == self.shipping_option_id