Sha256: 551099828fc84a1064b3897d66c5bfca91b09de0a90a389808d049e7699d6710

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

require 'test_helper'

class TestGeneral < Test::Unit::TestCase
  def setup
    setup_solusvm
    @general = Solusvm::General.new
  end

  def test_templates
    VCR.use_cassette "general/templates" do
      assert_equal %w(template1 template2 template3), @general.templates('xen')
    end
  end

  # TODO: Refactor so that the lib is not validating server types
  def test_templates_empty
    VCR.use_cassette "general/templates" do
      assert !@general.templates('openvz')
    end
  end

  def test_templates_with_invalid_type
    VCR.use_cassette "general/templates" do
      assert_raise Solusvm::SolusvmError do
        @general.templates('badserver')
      end
    end
  end

  def test_plans
    VCR.use_cassette "general/plans" do
      assert_equal %w(plan1 plan2 plan3 plan4), @general.plans('xen')
    end
  end

  def test_plans_empty
    VCR.use_cassette "general/plans" do
      assert !@general.plans('openvz')
    end
  end

  def test_plans_with_invalid_type
    VCR.use_cassette "general/plans" do
      assert_raise Solusvm::SolusvmError do
        @general.plans('whatever')
      end
    end
  end

  def test_isos
    VCR.use_cassette "general/isos" do
      assert_equal %w(iso1 iso2 iso3), @general.isos('xen')
    end
  end

  def test_isos_empty
    VCR.use_cassette "general/isos" do
      assert !@general.isos('openvz')
    end
  end

  def test_isos_with_invalid_type
    VCR.use_cassette "general/isos" do
      assert_raise Solusvm::SolusvmError do
        @general.isos('whatever')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solusvm-1.1.0.beta2 test/solusvm/test_general.rb
solusvm-1.1.0.beta1 test/solusvm/test_general.rb