Sha256: 6efc40b4d476dd3540e4721a88d713c2aecf25c61c040c711fc09db410462db2

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 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)
    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(client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get
    ]
    methods.each do |method|
      assert @deployments.respond_to? method, true
    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
    @service.stub :list_deployments, @response do
      assert_instance_of Fog::Resources::AzureRM::Deployment, @deployments.get('fog-test-deployment')
      assert @deployments.get('wrong-name').nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.5 test/models/resources/test_deployments.rb