Parent

Included Modules

Class/Module Index [+]

Quicksearch

DeltacloudUnitTest::RealmsTest

Public Instance Methods

app() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 24
def app
  Sinatra::Application
end
test_each_state_has_transition() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 37
def test_each_state_has_transition
  get_auth_url '/api/instance_states', {}
  (last_xml_response/'states/state').each do |state|
    next if state['name'].eql?('finish') # Finnish state doesn't have transitions
    (state/'transition').length.should > 0
    (state/'transition').each do |transition|
      transition['to'].should_not == nil
    end
  end
end
test_it_has_correct_attributes_set() click to toggle source
# File tests/drivers/mock/realms_test.rb, line 37
def test_it_has_correct_attributes_set
  get_auth_url '/api/realms', {}
  (last_xml_response/'realms/realm').each do |realm|
    realm.attributes.keys.sort.should == [ 'href', 'id' ]
  end
end
test_it_has_unique_ids() click to toggle source
# File tests/drivers/mock/realms_test.rb, line 56
def test_it_has_unique_ids
  get_auth_url '/api/realms', {}
  ids = []
  (last_xml_response/'realms/realm').each do |realm|
    ids << realm['id'].to_s
  end
  ids.sort.should == ids.sort.uniq
end
test_it_not_require_authentication() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 28
def test_it_not_require_authentication
  require_authentication?('/api/realms').should_not == true
end
test_it_responses_to_html() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 58
def test_it_responses_to_html
  get_url '/api/instance_states', {}, { :format => :html }
  last_response.status.should == 200
  Nokogiri::HTML(last_response.body).search('html').first.name.should == 'html'
end
test_it_responses_to_json() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 48
def test_it_responses_to_json
  # FIXME: This test is suffering from conflict between JSON gem and Activesupport
  # gem in EC2.
  #
  #do_request '/api/instance_states', {}, false, { :format => :json }
  #JSON::parse(last_response.body).class.should == Array
  #JSON::parse(last_response.body).first['transitions'].class.should == Array
  #JSON::parse(last_response.body).first['name'].should == 'start'
end
test_it_responses_to_png() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 64
def test_it_responses_to_png
  get_url '/api/instance_states', { :format => 'png' }
  last_response.status.should == 200
  last_response.headers['Content-Type'].should =~ /^image\/png/
end
test_it_returns_instance_states() click to toggle source
# File tests/drivers/mock/instance_states_test.rb, line 32
def test_it_returns_instance_states
  get_auth_url '/api/instance_states', {}
  (last_xml_response/'states/state').length.should > 0
end
test_it_returns_realms() click to toggle source
# File tests/drivers/mock/realms_test.rb, line 32
def test_it_returns_realms
  get_auth_url '/api/realms', {}
  (last_xml_response/'realms/realm').length.should > 0
end
test_it_returns_valid_realm() click to toggle source
# File tests/drivers/mock/realms_test.rb, line 50
def test_it_returns_valid_realm
  get_auth_url '/api/realms/us', {}
  realm = (last_xml_response/'realm')
  test_realm_attributes(realm)
end
test_us_has_correct_attributes() click to toggle source
# File tests/drivers/mock/realms_test.rb, line 44
def test_us_has_correct_attributes
  get_auth_url '/api/realms', {}
  realm = (last_xml_response/'realms/realm[@id="us"]')
  test_realm_attributes(realm)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.