File: dhcp_options_tests.rb

package info (click to toggle)
ruby-fog-aws 3.33.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,180 kB
  • sloc: ruby: 75,405; javascript: 14; makefile: 9; sh: 4
file content (39 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
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
Shindo.tests('Fog::Compute[:aws] | dhcp_options requests', ['aws']) do

  @dhcp_options_format = {
    'dhcpOptionsSet' => [{
      'dhcpOptionsId'            => String,
      'dhcpConfigurationSet'     => Hash,
      'tagSet'                   => Fog::Nullable::Hash,
    }],
    'requestId' => String
  }

  tests('success') do
    @vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
    @vpc_id = @vpc.id

    tests('#create_dhcp_options').formats(@dhcp_options_format) do
      data = Fog::Compute[:aws].create_dhcp_options({'domain-name' => 'example.com', 'domain-name-servers' => '10.10.10.10'}).body
      @dopt_id = data['dhcpOptionsSet'].first['dhcpOptionsId']
      data
    end

    tests('#describe_dhcp_options').formats(@dhcp_options_format) do
      Fog::Compute[:aws].describe_dhcp_options.body
    end

    tests("#associate_dhcp_options('#{@dopt_id}, #{@vpc_id}')").formats(AWS::Compute::Formats::BASIC) do
      Fog::Compute[:aws].associate_dhcp_options(@dopt_id, @vpc_id).body
    end

    tests("#associate_default_dhcp_options('default', #{@vpc_id}')").formats(AWS::Compute::Formats::BASIC) do
      Fog::Compute[:aws].associate_dhcp_options('default', @vpc_id).body
    end

    tests("#delete_dhcp_options('#{@dopt_id}')").formats(AWS::Compute::Formats::BASIC) do
      Fog::Compute[:aws].delete_dhcp_options(@dopt_id).body
    end
    @vpc.destroy
  end
end