Sha256: 25e9a56490132c7a63d4ab36e7b94875021c9cb23120111c4909a61f5aba482c

Contents?: true

Size: 1.3 KB

Versions: 14

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'
HostResponse = Struct.new(:body)
describe Infoblox::Host, "#add_ipv4addr" do
  it "adds an address correctly" do
    host = Infoblox::Host.new
    host.add_ipv4addr("10.10.10.10")
    host.add_ipv4addr("10.10.10.12")
    expect(host.ipv4addrs[0]).to be_a(Infoblox::HostIpv4addr)
    expect(host.ipv4addrs[0].ipv4addr).to eq("10.10.10.10")
  end

  it "initializes correctly" do
    data = {
      :name      => 'silly-little-host',
      :ipv4addrs => [{:ipv4addr => '10.10.10.10'}]
    }
    host = Infoblox::Host.new(data)
    expect(host.ipv4addrs[0]).to be_a(Infoblox::HostIpv4addr)
    expect(host.name).to eq('silly-little-host')
  end

  it "posts correctly" do
    conn = double
    uri = Infoblox.base_path + Infoblox::Host.wapi_object

    allow(conn).to receive(:post).with(uri, {
      :ipv4addrs => [{:ipv4addr => "10.10.10.10"}, 
                     {:ipv4addr => "192.168.1.1", 
                      :mac => "109coic0932j3n0293urf"}],
                      :name => "test-server.test.ing"
      }).and_return(HostResponse.new("\"hey\""))

    h = Infoblox::Host.new(:connection => conn)
    h.add_ipv4addr("10.10.10.10")
    h.ipv4addrs=([{:ipv4addr => "192.168.1.1", :mac => "109coic0932j3n0293urf"}])
    h.name = "test-server.test.ing"
    h.post
    expect(h._ref).to eq("hey")
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
infoblox-3.0.0 spec/host_spec.rb
infoblox-2.0.5 spec/host_spec.rb
infoblox-2.0.4 spec/host_spec.rb
infoblox-2.0.3 spec/host_spec.rb
infoblox-2.0.2 spec/host_spec.rb
infoblox-2.0.1 spec/host_spec.rb
infoblox-2.0.0 spec/host_spec.rb
infoblox-1.0.1 spec/host_spec.rb
infoblox-1.0.0 spec/host_spec.rb
infoblox-0.5.3 spec/host_spec.rb
infoblox-0.5.2 spec/host_spec.rb
infoblox-0.5.1 spec/host_spec.rb
infoblox-0.5.0 spec/host_spec.rb
infoblox-0.4.1 spec/host_spec.rb