Sha256: 2717d93e99e1f3488a9984be5112d2ec66d1e16478b424347d5ea6b0b7962689
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
# -*- encoding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Simplenet::Client::Ip do before(:all) do @conf = {:url => "http://localhost:8081"} @conn = Simplenet::Client::Connection.new(@conf) @dcid = @conn.datacenters.create(random_name_for("datacenter"))["id"] @zone = @conn.zones.create(@dcid, random_name_for("zone"))["id"] @vlan = @conn.vlans.create( @zone, random_name_for("vlan"), random_name_for("vlan").sub(/[a-zA-Z]+/,"") )["id"] @cidr = random_cidr @sbnt = @conn.subnets.create(@vlan, @cidr)["id"] end subject { @conn.ips } before do @ip = random_ip(@cidr) end it "creates a new ip" do resp = subject.create(@sbnt, @ip) expect(resp["ip"]).to eql(@ip) end it "lists all ips" do subject.create(@sbnt, @ip) list = subject.list.map{|dc| dc["ip"]} expect(list).to include(@ip) end it "get ip by ip" do ip = subject.create(@sbnt, @ip) retrieved = subject.by_ip(ip["ip"]).first expect(retrieved["id"]).to eql(ip["id"]) end it "shows a single ip by uuid" do resp = subject.create(@sbnt, @ip) show = subject.show(resp["id"]) expect(show["ip"]).to eql(@ip) end it "deletes a ip" do id = subject.create(@sbnt, @ip)["id"] subject.delete(id) list = subject.list.map{|dc| dc["ip"]} expect(list).to_not include(@ip) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simplenet-client-0.2.0 | ./spec/simplenet/client/ip_spec.rb |