Skip to content

Commit

Permalink
Make replace TwilioHttpClient in Python snippets more resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
hortega committed Sep 21, 2017
1 parent 0d256d2 commit 1c6a949
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/snippet-testing/language_handler/python_6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ def text_with_custom_header(file_content)

def replace_twilio_client_initialization(file_content)
cert_path = ENV['FAKE_CERT_PATH']
updated_file_content = file_content.gsub! 'Client(account_sid, auth_token)',
'Client(account_sid, auth_token, http_client=FakerHttpClient())'
updated_file_content == nil ? file_content : updated_file_content
result = ''
file_content.each_line do |line|
result += line.include?('client = Client(') ?
line.gsub!(')', ', http_client=FakerHttpClient())') : line
end
result
end
end
end

0 comments on commit 1c6a949

Please sign in to comment.