diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/run_tests | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bin/run_tests b/bin/run_tests index 3ba89684..2ee027f4 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -133,7 +133,11 @@ class LeapTest < MiniTest::Unit::TestCase http.use_ssl = true end http.start do |agent| - response = agent.get(uri.request_uri) + request = Net::HTTP::Get.new uri.request_uri + if uri.user + request.basic_auth uri.user, uri.password + end + response = agent.request(request) if response.is_a?(Net::HTTPSuccess) yield response.body, response, nil else @@ -158,6 +162,20 @@ class LeapTest < MiniTest::Unit::TestCase end # + # only a warning for now, should be a failure in the future + # + def assert_auth_fail(url, params) + uri = URI(url) + get(url, params) do |body, response, error| + unless response.code.to_s == "401" + warn "Expected a '401 Unauthorized' response, but got #{response.code} instead (GET #{uri.request_uri} with username '#{uri.user}')." + return false + end + end + true + end + + # # test if a socket can be connected to # |