#NEWLINE# @ mock . patch ( 'betamax.recorder.Betamax' , autospec = True ) #NEWLINE# def test_wraps_session( Betamax ) : #NEWLINE# #INDENT# recorder = mock . MagicMock ( spec = betamax . Betamax ) #NEWLINE# recorder . use_cassette . return_value = recorder #NEWLINE# Betamax . return_value = _test #NEWLINE# @ use_cassette ( 'foo' , cassette_library_dir = 'fizbarbogus' ) #NEWLINE# def _test( session ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# _test ( ) #NEWLINE# Betamax . assert_called_once_with ( session = mock . ANY , cassette_library_dir = 'fizbarbogus' , default_cassette_options = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# recorder . use_cassette . assert_called_once_with ( 'foo' )