Sha256: 65a58f832c856eff7ed6acccdebf0e0b413e9dfb3ba3d11e08d488736f2ea2c8

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

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

describe Simplenet::Client::Switch do
  subject { @conn.switches }

  before(:all) do
    @conf = {:url => "http://localhost:8081"}
    @conn = Simplenet::Client::Connection.new(@conf)
  end

  before do
    @name = random_name_for("switch")
    @mac  = "5c:f9:dd:eb:0c:67"
    @addr = "192.168.1.1:8888"
  end

  it "creates a new switch" do
    resp = subject.create(@name, @mac, @addr)

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

  it "lists all switches" do
    subject.create(@name, @mac, @addr)

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

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

  it "shows a single switch by uuid" do
    resp = subject.create(@name, @mac, @addr)
    show = subject.show(resp["id"])

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

  it "deletes a switch" do
    id = subject.create(random_name_for("switch"), @mac, @addr)["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/switch_spec.rb