Sha256: 3e82e82abe404c360f3fe6ea9d08d6721727cbd5c24aa64c418e1c3079801b1b
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
# -*- encoding: utf-8 -*- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Simplenet::Client::Subnet 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"] end subject { @conn.subnets } before do @cidr = "10.#{rand(0..255)}.#{rand(0..255)}.0/24" end it "creates a new subnet" do resp = subject.create(@vlan, @cidr) expect(resp["cidr"]).to eql(@cidr) end it "lists all subnets" do subject.create(@vlan, @cidr) list = subject.list.map{|dc| dc["cidr"]} expect(list).to include(@cidr) end it "shows a single subnet by uuid" do resp = subject.create(@vlan, @cidr) show = subject.show(resp["id"]) expect(show["cidr"]).to eql(@cidr) end it "deletes a subnet" do id = subject.create(@vlan, @cidr)["id"] subject.delete(id) list = subject.list.map{|dc| dc["cidr"]} expect(list).to_not include(@cidr) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simplenet-client-0.2.0 | ./spec/simplenet/client/subnet_spec.rb |