<s> import unittest <EOL> import mock <EOL> import json <EOL> import runabove <EOL> class TestAccount ( unittest . TestCase ) : <EOL> answer_account = '''<STR_LIT>''' <EOL> answer_balance = '''<STR_LIT>''' <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def setUp ( self , mock_wrapper ) : <EOL> self . mock_wrapper = mock_wrapper <EOL> self . account = runabove . account . AccountManager ( mock_wrapper , None ) <EOL> def test_base_path ( self ) : <EOL> self . assertEqual ( self . account . basepath , '<STR_LIT>' ) <EOL> def test_account_existance ( self ) : <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_account ) <EOL> account = self . account . get ( ) <EOL> self . assertIsInstance ( account , runabove . account . Account ) <EOL> def test_load_balance ( self ) : <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_balance ) <EOL> balance = self . account . _load_balance ( ) <EOL> self . assertIsInstance ( balance , tuple ) <EOL> self . assertTrue ( len ( balance ) == <NUM_LIT:2> ) <EOL> self . assertEqual ( balance [ <NUM_LIT:0> ] , <NUM_LIT> ) <EOL> self . assertEqual ( balance [ <NUM_LIT:1> ] , <NUM_LIT:200> ) <EOL> class TestAccountObject ( unittest . TestCase ) : <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def setUp ( self , mock_accounts ) : <EOL> self . mock_accounts = mock_accounts <EOL> self . account = runabove . account . Account ( <EOL> self . mock_accounts , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> None , <EOL> None , <EOL> None , <EOL> None , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_current_total ( self ) : <EOL> self . mock_accounts . _load_balance . return_value = ( <NUM_LIT> , <NUM_LIT:200> ) <EOL> self . assertEqual ( self . account . current_total , <NUM_LIT> ) <EOL> self . mock_accounts . _load_balance . assert_called_once ( ) <EOL> def test_credit_left ( self ) : <EOL> self . mock_accounts . _load_balance . return_value = ( <NUM_LIT> , <NUM_LIT:200> ) <EOL> self . assertEqual ( self . account . credit_left , <NUM_LIT:200> ) <EOL> self . mock_accounts . _load_balance . assert_called_once ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
