Project

General

Profile

Download (952 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / test / units / container_remover_test.rb @ 27a7d2c4

1
require 'test_plugin_helper'
2

    
3
module ForemanDocker
4
  class ContainerRemoverTest < ActiveSupport::TestCase
5
    describe '#remove_unmanaged' do
6
      setup do
7
        @docker_compute_resource = FactoryGirl.build_stubbed(:docker_cr)
8
        ComputeResource.expects(:authorized).
9
          with(:destroy_compute_resources_vms).
10
          returns(stub(:find => @docker_compute_resource))
11

    
12
        Fog.mock!
13
      end
14

    
15
      teardown { Fog.unmock! }
16

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

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

    
24
      test 'remove_unmanaged returns deleted_identifier' do
25
        assert_equal 'random-uuid',
26
          ForemanDocker::ContainerRemover.remove_unmanaged(
27
            @docker_compute_resource.id, 'random-uuid')
28
      end
29
    end
30
  end
31
end