Sha256: 50a0e79475c2b5430ba979e6acabf4893942f4777ac7b7da741dd1193bcaacc6

Contents?: true

Size: 1.95 KB

Versions: 14

Compression:

Stored size: 1.95 KB

Contents

Shindo.tests('Fog::Compute[:hp] | security group requests', ["hp"]) do

  @security_groups_format = {
    'security_groups' => [{
      'rules'       => [Fog::Nullable::Hash],
      'tenant_id'   => String,
      'id'          => Integer,
      'name'        => String,
      'description' => String
    }]
  }

  @security_group_format = {
    'rules'       => [Fog::Nullable::Hash],
    'tenant_id'   => String,
    'id'          => Integer,
    'name'        => String,
    'description' => String
  }

  tests('success') do

    tests("#create_security_group('fog_security_group', 'tests group')").formats({'security_group' => @security_group_format}) do
      data = Fog::Compute[:hp].create_security_group('fog_security_group', 'tests group').body
      @sec_group_id = data['security_group']['id']
      data
    end

    tests("#get_security_group('#{@sec_group_id}')").formats({'security_group' => @security_group_format}) do
      Fog::Compute[:hp].get_security_group(@sec_group_id).body
    end

    tests("#list_security_groups").formats(@security_groups_format) do
      Fog::Compute[:hp].list_security_groups.body
    end


    tests("#delete_security_group('#{@sec_group_id}')").succeeds do
      Fog::Compute[:hp].delete_security_group(@sec_group_id).body
    end

  end

  tests('failure') do

    @security_group = Fog::Compute[:hp].security_groups.create(:name => 'fog_security_group_fail', :description => 'tests group')

    tests("duplicate #create_security_group(#{@security_group.name}, #{@security_group.description})").raises(Excon::Errors::BadRequest) do
      Fog::Compute[:hp].create_security_group(@security_group.name, @security_group.description)
    end

    tests("#get_security_group(0)").raises(Fog::Compute::HP::NotFound) do
      Fog::Compute[:hp].get_security_group(0)
    end

    tests("#delete_security_group(0)").raises(Fog::Compute::HP::NotFound) do
      Fog::Compute[:hp].delete_security_group(0)
    end

    @security_group.destroy

  end

end

Version data entries

14 entries across 14 versions & 6 rubygems

Version Path
fog-nirvanix-1.8.2 tests/hp/requests/compute/security_group_tests.rb
fog-nirvanix-1.8.1 tests/hp/requests/compute/security_group_tests.rb
fog-parser-fix-1.6.1 tests/hp/requests/compute/security_group_tests.rb
fog-test-again-1.6.0 tests/hp/requests/compute/security_group_tests.rb
fog-parser-fix-1.6.0 tests/hp/requests/compute/security_group_tests.rb
fog-1.9.0 tests/hp/requests/compute/security_group_tests.rb
fog-maestrodev-1.8.0.20130114204828 tests/hp/requests/compute/security_group_tests.rb
fog-maestrodev-1.8.0.20130111070250 tests/hp/requests/compute/security_group_tests.rb
fog-maestrodev-1.8.0.20130109172219 tests/hp/requests/compute/security_group_tests.rb
fog-sgonyea-1.8.1 tests/hp/requests/compute/security_group_tests.rb
fog-1.8.0 tests/hp/requests/compute/security_group_tests.rb
fog-maestrodev-1.7.0.20121114190951 tests/hp/requests/compute/security_group_tests.rb
fog-1.7.0 tests/hp/requests/compute/security_group_tests.rb
fog-1.6.0 tests/hp/requests/compute/security_group_tests.rb