Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 96b7ee9

Browse files
committed
Fix python tests runner
1 parent 94f63f5 commit 96b7ee9

File tree

1 file changed

+14
-1
lines changed
  • tools/snippet-testing/language_handler

1 file changed

+14
-1
lines changed

tools/snippet-testing/language_handler/python.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ def self.run_before_test(directory)
1616
end
1717

1818
private
19-
19+
def text_with_custom_header(file_content)
20+
cert_path = ENV['FAKE_CERT_PATH']
21+
file_content.prepend(
22+
"import twilio.rest.resources.base\n"\
23+
"import sys\n"\
24+
"twilio.rest.resources.base.get_cert_file = lambda: '#{cert_path}'\n"\
25+
"sys.modules['twilio.rest.base.resources'] = twilio.rest.resources.base\n"
26+
)
27+
end
28+
def replace_twilio_client_initialization(file_content)
29+
cert_path = ENV['FAKE_CERT_PATH']
30+
file_content.gsub! 'Client(account_sid, auth_token)',
31+
'Client(account_sid, auth_token, http_client=FakerHttpClient())' || file_content
32+
end
2033
def execute_command(file)
2134
command = bash_string_command(
2235
'source /usr/local/bin/virtualenvwrapper.sh &&'\

0 commit comments

Comments
 (0)