<s> from tests . unit import unittest <EOL> import sys <EOL> import os <EOL> import os . path <EOL> simple = True <EOL> advanced = False <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> devpath = os . path . relpath ( os . path . join ( '<STR_LIT:..>' , '<STR_LIT:..>' ) , <EOL> start = os . path . dirname ( __file__ ) ) <EOL> sys . path = [ devpath ] + sys . path <EOL> print '<STR_LIT>' <EOL> advanced = True <EOL> from boto . fps . connection import FPSConnection <EOL> from boto . fps . response import ComplexAmount <EOL> class FPSTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . fps = FPSConnection ( host = '<STR_LIT>' ) <EOL> if advanced : <EOL> self . activity = self . fps . get_account_activity ( StartDate = '<STR_LIT>' ) <EOL> result = self . activity . GetAccountActivityResult <EOL> self . transactions = result . Transaction <EOL> @ unittest . skipUnless ( simple , "<STR_LIT>" ) <EOL> def test_get_account_balance ( self ) : <EOL> response = self . fps . get_account_balance ( ) <EOL> self . assertTrue ( hasattr ( response , '<STR_LIT>' ) ) <EOL> self . assertTrue ( hasattr ( response . GetAccountBalanceResult , <EOL> '<STR_LIT>' ) ) <EOL> accountbalance = response . GetAccountBalanceResult . AccountBalance <EOL> self . assertTrue ( hasattr ( accountbalance , '<STR_LIT>' ) ) <EOL> self . assertIsInstance ( accountbalance . TotalBalance , ComplexAmount ) <EOL> self . assertTrue ( hasattr ( accountbalance , '<STR_LIT>' ) ) <EOL> availablebalances = accountbalance . AvailableBalances <EOL> self . assertTrue ( hasattr ( availablebalances , '<STR_LIT>' ) ) <EOL> @ unittest . skipUnless ( simple , "<STR_LIT>" ) <EOL> def test_complex_amount ( self ) : <EOL> response = self . fps . get_account_balance ( ) <EOL> accountbalance = response . GetAccountBalanceResult . AccountBalance <EOL> asfloat = float ( accountbalance . TotalBalance . Value ) <EOL> self . assertIn ( '<STR_LIT:.>' , str ( asfloat ) ) <EOL> @ unittest . skipUnless ( simple , "<STR_LIT>" ) <EOL> def test_required_arguments ( self ) : <EOL> with self . assertRaises ( KeyError ) : <EOL> self . fps . write_off_debt ( AdjustmentAmount = <NUM_LIT> ) <EOL> @ unittest . skipUnless ( simple , "<STR_LIT>" ) <EOL> def test_cbui_url ( self ) : <EOL> inputs = { <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:foo>' , <EOL> } <EOL> result = self . fps . cbui_url ( ** inputs ) <EOL> print "<STR_LIT>" . format ( result ) <EOL> @ unittest . skipUnless ( simple , "<STR_LIT>" ) <EOL> def test_get_account_activity ( self ) : <EOL> response = self . fps . get_account_activity ( StartDate = '<STR_LIT>' ) <EOL> self . assertTrue ( hasattr ( response , '<STR_LIT>' ) ) <EOL> result = response . GetAccountActivityResult <EOL> self . assertTrue ( hasattr ( result , '<STR_LIT>' ) ) <EOL> try : <EOL> int ( result . BatchSize ) <EOL> except : <EOL> self . assertTrue ( False ) <EOL> @ unittest . skipUnless ( advanced , "<STR_LIT>" ) <EOL> def test_get_transaction ( self ) : <EOL> assert len ( self . transactions ) <EOL> transactionid = self . transactions [ <NUM_LIT:0> ] . TransactionId <EOL> result = self . fps . get_transaction ( TransactionId = transactionid ) <EOL> self . assertTrue ( hasattr ( result . GetTransactionResult , '<STR_LIT>' ) ) <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_bad_request ( self ) : <EOL> try : <EOL> self . fps . write_off_debt ( CreditInstrumentId = '<STR_LIT:foo>' , <EOL> AdjustmentAmount = <NUM_LIT> ) <EOL> except Exception as e : <EOL> print e <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_repr ( self ) : <EOL> print self . fps . get_account_balance ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
