File tree Expand file tree Collapse file tree 4 files changed +34
-8
lines changed
Expand file tree Collapse file tree 4 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,17 @@ def request(
106106
107107 @property
108108 def accounts (self ) -> Dict [str , Account ]:
109- accounts_ = dict (primary = Account (** self .get ('/account' )))
110- if self .topup_key :
111- accounts_ ['topup' ] = Account (** self .get ('/account' , topup = True ))
109+ if self .proxy :
110+ accounts_dict = self .get ('/account' )
111+ accounts_ = {
112+ key : Account (** val ) for key , val in accounts_dict .items ()
113+ }
114+ else :
115+ accounts_ = dict (primary = Account (** self .get ('/account' )))
116+ if self .topup_key :
117+ accounts_ ['topup' ] = Account (
118+ ** self .get ('/account' , topup = True )
119+ )
112120 return accounts_
113121
114122 @staticmethod
Original file line number Diff line number Diff line change 1- __version__ = '1.2.1 ' # pragma: no cover
1+ __version__ = '1.2.2 ' # pragma: no cover
Original file line number Diff line number Diff line change @@ -18,10 +18,18 @@ def client_proxy():
1818 m .get (
1919 f'{ proxy } /account' ,
2020 json = dict (
21- name = 'Cuenca' ,
22- balance = 60454.43 ,
23- minimum_balance = 0.0 ,
24- currency = 'MXN' ,
21+ primary = dict (
22+ name = 'cuenca' ,
23+ balance = 63869.33 ,
24+ minimum_balance = 0.0 ,
25+ currency = 'MXN' ,
26+ ),
27+ topup = dict (
28+ name = 'cuenca-tae' ,
29+ balance = 69720.0 ,
30+ minimum_balance = 0.0 ,
31+ currency = 'MXN' ,
32+ ),
2533 ),
2634 )
2735 m .post (
Original file line number Diff line number Diff line change @@ -19,6 +19,16 @@ def test_get_account_info(client):
1919 assert account .balance > account .minimum_balance
2020
2121
22+ @pytest .mark .vcr
23+ def test_get_topup_account_info (client_proxy ):
24+ accounts = client_proxy .get ('/account' , topup = True )
25+ for account in accounts .values ():
26+ assert type (account ) is dict
27+ assert account ['currency' ] == 'MXN'
28+ assert type (account ['balance' ]) is float
29+ assert account ['balance' ] > account ['minimum_balance' ]
30+
31+
2232def test_get_account_info_proxy (client_proxy ):
2333 accounts = client_proxy .accounts
2434 assert type (accounts ) is dict
You can’t perform that action at this time.
0 commit comments