Sha256: 8bf108b9fe8f1360236b76aa68a267bee351e9aaf4251d923ce3540f41678092

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

require 'test_helper'

class TestReseller < Test::Unit::TestCase
  def setup
    @reseller = SolusVM::Reseller.new(solusvm_params)
  end

  def test_create
    options = {
      username:  'apitest3',
      password:  '123456',
      email:     'email@address.com',
      firstname: 'Phill',
      lastname:  'Smith'
    }

    stub_response 'reseller/create'

    assert @reseller.create(options).is_a? Hash
    assert @reseller.successful?
  end

  def test_create_fail
    stub_response 'generic/error'

    assert !@reseller.create
    assert !@reseller.successful?
  end

  def test_change_resources
    stub_response 'reseller/change-resources'

    assert @reseller.change_resources("vps123", maxvps: 10).is_a? Hash
    assert @reseller.successful?
  end

  def test_change_resources_fail
    stub_response 'generic/error'

    assert !@reseller.change_resources("vps13")
    assert !@reseller.successful?
  end

  def test_info
    stub_response 'reseller/info'

    assert @reseller.info("vps123").is_a? Hash
    assert @reseller.successful?
  end

  def test_info_fail
    stub_response 'generic/error'

    assert !@reseller.info("vps13")
    assert !@reseller.successful?
  end

  def test_list
    stub_response 'reseller/list'

    list = @reseller.list

    assert list.is_a? Array
    assert_not_empty list
    assert @reseller.successful?
  end

  def test_list_empty
    stub_response 'reseller/list-empty'

    assert !@reseller.list
    assert @reseller.successful?
  end

  def test_delete
    stub_response 'reseller/delete'

    assert @reseller.delete("vps123")
    assert @reseller.successful?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solusvm-2.0.1.beta6 test/solusvm/test_reseller.rb
solusvm-2.0.0.beta6 test/solusvm/test_reseller.rb
solusvm-2.0.0.beta5 test/solusvm/test_reseller.rb
solusvm-2.0.0.beta4 test/solusvm/test_reseller.rb
solusvm-2.0.0.beta2 test/solusvm/test_reseller.rb
solusvm-2.0.0.beta1 test/solusvm/test_reseller.rb