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

Commit bd80d1d

Browse files
committed
Restore missing python tests runner methods
1 parent 4931fc5 commit bd80d1d

File tree

1 file changed

+15
-0
lines changed
  • tools/snippet-testing/language_handler

1 file changed

+15
-0
lines changed

Diff for: tools/snippet-testing/language_handler/python.rb

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ def execute_command(file)
2626
execute_with_suppressed_output(command, file)
2727
end
2828

29+
def text_with_custom_header(file_content)
30+
cert_path = ENV['FAKE_CERT_PATH']
31+
file_content.prepend(
32+
"import twilio.rest.resources.base\n"\
33+
"import sys\n"\
34+
"twilio.rest.resources.base.get_cert_file = lambda: '#{cert_path}'\n"\
35+
"sys.modules['twilio.rest.base.resources'] = twilio.rest.resources.base\n"
36+
)
37+
end
38+
def replace_twilio_client_initialization(file_content)
39+
cert_path = ENV['FAKE_CERT_PATH']
40+
file_content.gsub! 'Client(account_sid, auth_token)',
41+
'Client(account_sid, auth_token, http_client=FakerHttpClient())' || file_content
42+
end
43+
2944
def text_with_specific_replacements(file_content)
3045
text_with_custom_header(file_content)
3146
replace_twilio_client_initialization(file_content)

0 commit comments

Comments
 (0)