Sha256: d7e2c0fe3095afbb291a432c0f3970222c2a747befddc78c81068011ede22d6b

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

require 'test_plugin_helper'

module ForemanDocker
  class ContainerRemoverTest < ActiveSupport::TestCase
    describe '#remove_unmanaged' do
      setup do
        @docker_compute_resource = FactoryBot.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

4 entries across 4 versions & 1 rubygems

Version Path
foreman_docker-5.0.0 test/units/container_remover_test.rb
foreman_docker-4.1.1 test/units/container_remover_test.rb
foreman_docker-4.1.0 test/units/container_remover_test.rb
foreman_docker-4.0.0 test/units/container_remover_test.rb