fix setting bot on ShippingQuery (#1355)

* fix setting bot on ShippingQuery

* Fix test to test de_json
This commit is contained in:
Eldinnie 2019-02-23 21:33:03 +01:00 committed by GitHub
parent 0c10c537f7
commit 36a74da4f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -64,7 +64,7 @@ class ShippingQuery(TelegramObject):
data['from_user'] = User.de_json(data.pop('from'), bot) data['from_user'] = User.de_json(data.pop('from'), bot)
data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot) data['shipping_address'] = ShippingAddress.de_json(data.get('shipping_address'), bot)
return cls(**data) return cls(bot=bot, **data)
def answer(self, *args, **kwargs): def answer(self, *args, **kwargs):
"""Shortcut for:: """Shortcut for::

View file

@ -50,6 +50,7 @@ class TestShippingQuery(object):
assert shipping_query.invoice_payload == self.invoice_payload assert shipping_query.invoice_payload == self.invoice_payload
assert shipping_query.from_user == self.from_user assert shipping_query.from_user == self.from_user
assert shipping_query.shipping_address == self.shipping_address assert shipping_query.shipping_address == self.shipping_address
assert shipping_query.bot == bot
def test_to_dict(self, shipping_query): def test_to_dict(self, shipping_query):
shipping_query_dict = shipping_query.to_dict() shipping_query_dict = shipping_query.to_dict()