Class: Conify::DeprovisionTest

Inherits:
ApiTest show all
Defined in:
lib/conify/test/deprovision_test.rb

Constant Summary collapse

OUTPUT_COMPLETION =
true

Instance Attribute Summary

Attributes inherited from Test

#data

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

#callObject

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/conify/test/deprovision_test.rb', line 7

def call
  external_uuid = data[:external_uuid]
  raise ArgumentError, 'Deprovision Test: No external_uuid specified' if external_uuid.nil?
  path = "#{base_path}/#{external_uuid.to_s}"

  test 'response' do
    code, _ = delete(credentials, path, nil)
    if code == 200
      true
    elsif code == -1
      error "Deprovision Test: unable to connect to #{url}"
    else
      error "Deprovision Test: expected 200, got #{code}"
    end
  end

  test 'authentication' do
    code, _ = delete(invalid_creds, path, nil)
    error "Deprovision Test: expected 401, got #{code}" if code != 401
    true
  end
end