Sha256: 7857cf15d85ec7502060da1eeb3ba08fc485479104dda93337135c809da49311

Contents?: true

Size: 952 Bytes

Versions: 6

Compression:

Stored size: 952 Bytes

Contents

require 'test_plugin_helper'

module ForemanDocker
  class ContainerRemoverTest < ActiveSupport::TestCase
    describe '#remove_unmanaged' do
      setup do
        @docker_compute_resource = FactoryGirl.build_stubbed(:docker_cr)
        ComputeResource.expects(:authorized).
          with(:destroy_compute_resources_vms).
          returns(stub(:find => @docker_compute_resource))

        Fog.mock!
      end

      teardown { Fog.unmock! }

      test 'remove_unmanaged makes call to the Docker API' do
        @docker_compute_resource.expects(:destroy_vm).with('random-uuid')

        assert ForemanDocker::ContainerRemover.remove_unmanaged(
          @docker_compute_resource.id, 'random-uuid')
      end

      test 'remove_unmanaged returns deleted_identifier' do
        assert_equal 'random-uuid',
          ForemanDocker::ContainerRemover.remove_unmanaged(
            @docker_compute_resource.id, 'random-uuid')
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_docker-3.2.1 test/units/container_remover_test.rb
foreman_docker-3.2.0 test/units/container_remover_test.rb
foreman_docker-3.1.0 test/units/container_remover_test.rb
foreman_docker-3.0.0 test/units/container_remover_test.rb
foreman_docker-2.1.1 test/units/container_remover_test.rb
foreman_docker-2.1.0 test/units/container_remover_test.rb