Class: Conify::SsoTest
- Defined in:
- lib/conify/test/sso_test.rb
Constant Summary collapse
- OUTPUT_COMPLETION =
true
Instance Attribute Summary
Attributes inherited from Test
Instance Method Summary collapse
Methods inherited from ApiTest
#base_path, #callback, #conflux_id, #create_provision_payload, #credentials, #invalid_creds
Methods included from HTTPForTests
#delete, #get, #post, #put, #request
Methods inherited from Test
#api_requires?, #env, #initialize, #run, #url
Methods included from Helpers
#allow_user_response, #ask_for_conflux_creds, #ask_for_password, #ask_for_password_on_windows, #camelize, #display, #echo_off, #echo_on, #error, #exclusive_deep_merge, #format_with_bang, #host, #host_url, #kensa_manifest_name, #kensa_manifest_path, #manifest_content, #manifest_filename, #manifest_path, #manually_added_methods, #open_url, #running_on_a_mac?, #running_on_windows?, #site_url, #to_table, #with_tty
Constructor Details
This class inherits a constructor from Conify::Test
Instance Method Details
#agent ⇒ Object
9 10 11 |
# File 'lib/conify/test/sso_test.rb', line 9 def agent @agent ||= Mechanize.new end |
#call ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/conify/test/sso_test.rb', line 32 def call error 'SSO Test: Need an sso salt to perform sso test' unless data['api']['sso_salt'] test 'validates token' do @sso.token = 'invalid' page, respcode = mechanize_get error "SSO Test: expected 403, got #{respcode}" unless respcode == 403 true end test 'validates timestamp' do @sso. = (Time.now - (60 * 6)).to_i page, respcode = mechanize_get error "SSO Test: expected 403, got #{respcode}" unless respcode == 403 true end page_logged_in = nil test 'logs in' do page_logged_in, respcode = mechanize_get error "SSO Test: expected 200, got #{respcode}" unless respcode == 200 true end end |
#mechanize_get ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/conify/test/sso_test.rb', line 13 def mechanize_get if @sso.POST? page = agent.post(@sso.post_url, @sso.query_params) else page = agent.get(@sso.get_url) end return page, 200 rescue Mechanize::ResponseCodeError => error return nil, error.response_code.to_i rescue Errno::ECONNREFUSED error "SSO Test: connection refused to #{url}" end |