<s> import stripe <EOL> from stripe . test . helper import ( <EOL> StripeApiTestCase , MyCreatable <EOL> ) <EOL> class CreateableAPIResourceTests ( StripeApiTestCase ) : <EOL> def test_create ( self ) : <EOL> self . mock_response ( { <EOL> '<STR_LIT:object>' : '<STR_LIT>' , <EOL> '<STR_LIT:foo>' : '<STR_LIT:bar>' , <EOL> } ) <EOL> res = MyCreatable . create ( ) <EOL> self . requestor_mock . request . assert_called_with ( <EOL> '<STR_LIT>' , '<STR_LIT>' , { } , None ) <EOL> self . assertTrue ( isinstance ( res , stripe . Charge ) ) <EOL> self . assertEqual ( '<STR_LIT:bar>' , res . foo ) <EOL> def test_idempotent_create ( self ) : <EOL> self . mock_response ( { <EOL> '<STR_LIT:object>' : '<STR_LIT>' , <EOL> '<STR_LIT:foo>' : '<STR_LIT:bar>' , <EOL> } ) <EOL> res = MyCreatable . create ( idempotency_key = '<STR_LIT:foo>' ) <EOL> self . requestor_mock . request . assert_called_with ( <EOL> '<STR_LIT>' , '<STR_LIT>' , { } , { '<STR_LIT>' : '<STR_LIT:foo>' } ) <EOL> self . assertTrue ( isinstance ( res , stripe . Charge ) ) <EOL> self . assertEqual ( '<STR_LIT:bar>' , res . foo ) </s>
