Class: Conify::ProvisionTest
- Defined in:
- lib/conify/test/provision_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, #test, #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
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/conify/test/provision_test.rb', line 9 def call response, code, json = nil payload = create_provision_payload data[:external_username] = payload[:conflux_id] # store for later test 'response' do code, json = post(credentials, base_path, payload) if code == 200 # Good shit elsif code == -1 error "Provision Test: unable to connect to #{url}" else error "Provision Test: expected 200, got #{code}" end true end test 'valid JSON' do begin response = OkJson.decode(json) rescue OkJson::Error => e error e. rescue NoMethodError => e error 'Provision Test: error parsing JSON' end true end test 'authentication' do code, _ = post(invalid_creds, base_path, payload) error "Provision Test: expected 401, got #{code}" if code != 401 true end data[:provision_response] = response run(Conify::ProvisionResponseTest, data) end |