<s> from sure import this <EOL> from unittest import TestCase <EOL> from coinbase . models import CoinbaseAmount <EOL> from coinbase . errors import UrlValueError <EOL> from . import account_setup <EOL> from . http_mocking import * <EOL> @ with_http_mocking <EOL> class BalanceTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> mock_http ( '<STR_LIT>' , <EOL> response_body ) <EOL> def test_balance_with_key ( self ) : <EOL> account = account_setup . with_key ( ) <EOL> this ( account . balance ) . should . equal ( expected_balance ) <EOL> this ( last_request_params ( ) ) . should . equal ( { <EOL> '<STR_LIT>' : [ account_setup . api_key ] <EOL> } ) <EOL> def test_balance_with_oauth ( self ) : <EOL> account = account_setup . with_oauth ( ) <EOL> this ( account . balance ) . should . equal ( expected_balance ) <EOL> this ( last_request_params ( ) ) . should . equal ( { } ) <EOL> response_body = """<STR_LIT>""" <EOL> expected_balance = CoinbaseAmount ( '<STR_LIT:1.0>' , '<STR_LIT>' ) <EOL> def test_url_injection_attempt ( ) : <EOL> account = account_setup . with_oauth ( ) <EOL> this ( lambda : account . get_order ( '<STR_LIT>' ) ) . should . throw ( UrlValueError ) </s>
