#NEWLINE# @ patch ( 'braubuddy.output.twitterapi.twitter' ) #NEWLINE# def test_auth_without_creds_file( self , mk_twitter ) : #NEWLINE# #INDENT# 'A new credentials file is created.' #NEWLINE# fake_token = '0123456789' #NEWLINE# fake_secret = 'abcdefghij' #NEWLINE# fake_creds_dir = tempfile . mkdtemp ( ) #NEWLINE# fake_creds_file = os . path . join ( fake_creds_dir , twitterapi . CREDS_FILENAME ) #NEWLINE# mk_twitter . read_token_file . return_value = ( fake_token , fake_token ) #NEWLINE# with patch ( 'braubuddy.output.twitterapi.CREDS_FILE' , new = fake_creds_file ) : #NEWLINE# #INDENT# test_output = twitterapi . TwitterAPIOutput ( ) #NEWLINE# mk_twitter . oauth_dance . assert_called_once_with ( twitterapi . APP , twitterapi . TCK , twitterapi . TCS , fake_creds_file ) #NEWLINE# #UNINDENT# shutil . rmtree ( fake_creds_dir )