Sha256: cc9fe58036f6f10312f81277079514ca1450428f9246436cdec7517302f69280

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

$:.unshift File.dirname(__FILE__)
require 'test_helper'

module ChefVPCToolkit
module CloudServersVPC

class ServerTest < Test::Unit::TestCase

  include ChefVPCToolkit::CloudServersVPC

  def setup
    @tmp_dir=TmpDir.new_tmp_dir
    ServerGroup.data_dir=@tmp_dir
  end

  def teardown
    FileUtils.rm_rf(@tmp_dir)
  end

  def test_vpn_server_rebuild_fails
    group=ServerGroup.from_xml(SERVER_GROUP_XML)
    server=group.server("login1")
    assert_raises(RuntimeError) do
        server.rebuild
    end
  end

  def test_rebuild
    group=ServerGroup.from_xml(SERVER_GROUP_XML)
    server=group.server("test1")
    Connection.stubs(:post).returns("")
    server.rebuild
  end

  def test_from_to_xml
    server=Server.from_xml(SERVER_XML)
    server=Server.from_xml(server.to_xml)
    assert_equal "db1", server.name
    assert_equal "blah", server.description
    assert_equal 1234, server.id
    assert_equal 888, server.cloud_server_id_number
    assert_equal 999, server.server_group_id
    assert_equal "10.119.225.116", server.internal_ip_addr
    assert_equal "123.100.100.100", server.external_ip_addr
    assert_equal "Online", server.status
  end

  def test_create

    Connection.stubs(:post).returns(SERVER_XML)
    server=Server.create(Server.from_xml(SERVER_XML))
    assert_equal "db1", server.name

  end

  def test_delete

    server=Server.from_xml(SERVER_XML)
    Connection.stubs(:delete).returns("")
    assert server.delete

  end

end

end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chef-vpc-toolkit-2.8.2 test/server_test.rb
chef-vpc-toolkit-2.8.1 test/server_test.rb
chef-vpc-toolkit-2.8.0 test/server_test.rb
chef-vpc-toolkit-2.7.2 test/server_test.rb
chef-vpc-toolkit-2.7.1 test/server_test.rb
chef-vpc-toolkit-2.7.0 test/server_test.rb
chef-vpc-toolkit-2.6.1 test/server_test.rb
chef-vpc-toolkit-2.6.0 test/server_test.rb
chef-vpc-toolkit-2.5.2 test/server_test.rb
chef-vpc-toolkit-2.5.1 test/server_test.rb