Sha256: 4d1c14eba6b6160a9ce348b3f2c51e8f1d10578a682b30a761280750d6e886df

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# -*- encoding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Simplenet::Client::Vlan 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"]
  end

  before do
    @name = random_name_for("vlan")
    @vnum = @name.sub(/[a-zA-Z]+/, "")
  end

  subject { @conn.vlans }

  it "creates a new vlan" do
    resp = subject.create(@zone, @name, @vnum)
    expect(resp["name"]).to eql(@name)
  end

  it "lists all vlans" do
    subject.create(@zone, @name, @vnum)

    list = subject.list.map{|dc| dc["name"]}

    expect(list).to include(@name)
  end

  it "shows a single vlan by uuid" do
    resp = subject.create(@zone, @name, @vnum)
    show = subject.show(resp["id"])

    expect(show["name"]).to eql(@name)
  end

  it "deletes a vlan" do
    id = subject.create(@zone, @name, @vnum)["id"]
    subject.delete(id)

    list = subject.list.map{|dc| dc["name"]}
    expect(list).to_not include(@name)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplenet-client-0.2.0 ./spec/simplenet/client/vlan_spec.rb