Store bot in PreCheckoutQuery (#953)

Fixes #937
This commit is contained in:
Daniel Reed 2017-12-30 04:48:38 -08:00 committed by Noam Meltzer
parent 3d4e0500bf
commit 5c8470e552
3 changed files with 3 additions and 1 deletions

View file

@ -22,6 +22,7 @@ The following wonderful people contributed directly or indirectly to this projec
- `bimmlerd <https://github.com/bimmlerd>`_ - `bimmlerd <https://github.com/bimmlerd>`_
- `d-qoi <https://github.com/d-qoi>`_ - `d-qoi <https://github.com/d-qoi>`_
- `daimajia <https://github.com/daimajia>`_ - `daimajia <https://github.com/daimajia>`_
- `Daniel Reed <https://github.com/nmlorg>`_
- `Eli Gao <https://github.com/eligao>`_ - `Eli Gao <https://github.com/eligao>`_
- `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_ - `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_
- `Eugene Lisitsky <https://github.com/lisitsky>`_ - `Eugene Lisitsky <https://github.com/lisitsky>`_

View file

@ -87,7 +87,7 @@ class PreCheckoutQuery(TelegramObject):
data['from_user'] = User.de_json(data.pop('from'), bot) data['from_user'] = User.de_json(data.pop('from'), bot)
data['order_info'] = OrderInfo.de_json(data.get('order_info'), bot) data['order_info'] = OrderInfo.de_json(data.get('order_info'), bot)
return cls(**data) return cls(bot=bot, **data)
def to_dict(self): def to_dict(self):
data = super(PreCheckoutQuery, self).to_dict() data = super(PreCheckoutQuery, self).to_dict()

View file

@ -55,6 +55,7 @@ class TestPreCheckoutQuery(object):
} }
pre_checkout_query = PreCheckoutQuery.de_json(json_dict, bot) 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.id == self.id
assert pre_checkout_query.invoice_payload == self.invoice_payload assert pre_checkout_query.invoice_payload == self.invoice_payload
assert pre_checkout_query.shipping_option_id == self.shipping_option_id assert pre_checkout_query.shipping_option_id == self.shipping_option_id