Sha256: 4660addf57e176d9ed8230303ed0c8b721a364f3a71cec6aa1af50bf754fd8b6

Contents?: true

Size: 1.69 KB

Versions: 46

Compression:

Stored size: 1.69 KB

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for Deployment Collection
class TestDeployments < Minitest::Test
  def setup
    @service = Fog::Resources::AzureRM.new(credentials)
    @rmc_client = @service.instance_variable_get(:@rmc)
    @deployments = Fog::Resources::AzureRM::Deployments.new(resource_group: 'fog-test-rg', service: @service)
    @response = ApiStub::Models::Resources::Deployment.list_deployments_response(@rmc_client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get,
      :check_deployment_exists
    ]
    methods.each do |method|
      assert_respond_to @deployments, method
    end
  end

  def test_all_method_response
    @service.stub :list_deployments, @response do
      assert_instance_of Fog::Resources::AzureRM::Deployments, @deployments.all
      assert @deployments.all.size >= 1
      @deployments.all.each do |deployment|
        assert_instance_of Fog::Resources::AzureRM::Deployment, deployment
      end
    end
  end

  def test_get_method_response
    response = ApiStub::Models::Resources::Deployment.create_deployment_response(@rmc_client)
    @service.stub :get_deployment, response do
      assert_instance_of Fog::Resources::AzureRM::Deployment, @deployments.get('fog-test-rg', 'fog-test-deployment')
    end
  end

  def test_check_deployment_exists_true_response
    @service.stub :check_deployment_exists, true do
      assert @deployments.check_deployment_exists('fog-test-rg', 'fog-test-deployment')
    end
  end

  def test_check_deployment_exists_false_response
    @service.stub :check_deployment_exists, false do
      assert !@deployments.check_deployment_exists('fog-test-rg', 'fog-test-deployment')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

Version Path
fog-azure-rm-0.4.1 test/models/resources/test_deployments.rb
fog-azure-rm-0.4.0 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.9 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.8 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.7 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.6 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.5 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.4 test/models/resources/test_deployments.rb
fog-azure-rm-temp-0.0.4 test/models/resources/test_deployments.rb
fog-azure-rm-temp-0.0.3 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.3 test/models/resources/test_deployments.rb
fog-azure-rm-temp-0.0.2 test/models/resources/test_deployments.rb
fog-azure-rm-temp-0.0.1 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.2 test/models/resources/test_deployments.rb
fog-azure-rm-downgraded-0.3.1 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.1 test/models/resources/test_deployments.rb
fog-azure-rm-downgraded-0.3.0 test/models/resources/test_deployments.rb
fog-azure-rm-0.3.0 test/models/resources/test_deployments.rb
fog-azure-rm-0.2.7 test/models/resources/test_deployments.rb
fog-azure-rm-0.2.6 test/models/resources/test_deployments.rb