Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added options for enabling cURL verbose output and disabling ssl cert… #49

Merged
merged 5 commits into from
Jun 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pyresttest/resttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ def run_test(mytest, test_config = TestConfig(), context = None):
body = StringIO()
curl.setopt(pycurl.WRITEDATA, body)
curl.setopt(pycurl.HEADERFUNCTION, headers.write)
if test_config.verbose:
curl.setopt(pycurl.VERBOSE,True)
if test_config.ssl_insecure:
curl.setopt(pycurl.SSL_VERIFYPEER,0)
curl.setopt(pycurl.SSL_VERIFYHOST,0)

result.passed = None

Expand Down Expand Up @@ -694,6 +699,12 @@ def main(args):
if 'interactive' in args and args['interactive'] is not None:
t.config.interactive = safe_to_bool(args['interactive'])

if 'verbose' in args and args['verbose'] is not None:
t.config.verbose = safe_to_bool(args['verbose'])

if 'ssl_insecure' in args and args['ssl_insecure'] is not None:
t.config.ssl_insecure = safe_to_bool(args['ssl_insecure'])

# Execute all testsets
failures = run_testsets(tests)

Expand All @@ -709,6 +720,8 @@ def command_line_run(args_in):
parser.add_option(u"--test", help="Test file to use", action="store", type="string")
parser.add_option(u'--import_extensions', help='Extensions to import, separated by semicolons', action="store", type="string")
parser.add_option(u'--vars', help='Variables to set, as a YAML dictionary', action="store", type="string")
parser.add_option(u'--verbose', help='Put cURL into verbose mode for extra debugging power', action='store_true', default=False, dest="verbose")
parser.add_option(u'--ssl-insecure', help='Disable cURL host and peer cert verification', action='store_true', default=False, dest="ssl_insecure")

(args, unparsed_args) = parser.parse_args(args_in)
args = vars(args)
Expand All @@ -731,4 +744,4 @@ def command_line_run(args_in):

#Allow import into another module without executing the main method
if(__name__ == '__main__'):
command_line_run(sys.argv[1:])
command_line_run(sys.argv[1:])