Project

General

Profile

Download (1.5 KB) Statistics
| Branch: | Tag: | Revision:

foreman-docker / test / functionals / containers_steps_controller_test.rb @ 5397ee73

1 3bc253a2 David Davis
require 'test_plugin_helper'
2
3
module Containers
4
  class StepsControllerTest < ActionController::TestCase
5 38e5019c Daniel Lobato
    setup do
6 3bc253a2 David Davis
      @container = FactoryGirl.create(:container)
7 38e5019c Daniel Lobato
    end
8
9 8d215ef6 Daniel Lobato
    test 'wizard finishes with a redirect to the managed container' do
10 6d101d7a Dmitri Dolguikh
      state = DockerContainerWizardState.create!
11 63ae5d99 Dmitri Dolguikh
      Service::Containers.any_instance.expects(:start_container!).with(equals(state))
12
        .returns(@container)
13 6d101d7a Dmitri Dolguikh
      put :update, { :wizard_state_id => state.id,
14
                     :id => :environment,
15
                     :docker_container_wizard_states_environment => { :tty => false } },
16
          set_session_user
17
18 8d215ef6 Daniel Lobato
      assert_redirected_to container_path(:id => @container.id)
19
    end
20 41572b90 Partha Aji
21
    test 'image show doesnot load katello' do
22
      compute_resource = FactoryGirl.create(:docker_cr)
23
      state = DockerContainerWizardState.create!
24
      create_options = { :wizard_state => state,
25
                         :compute_resource_id => compute_resource.id
26
27
                       }
28
      state.preliminary = DockerContainerWizardStates::Preliminary.create!(create_options)
29
      DockerContainerWizardState.expects(:find).at_least_once.returns(state)
30
      get :show, { :wizard_state_id => state.id, :id => :image }, set_session_user
31
      refute state.image.katello?
32
      refute response.body.include?("katello") # this is code generated by katello partial
33
      docker_image = @controller.instance_eval do
34
        @docker_container_wizard_states_image
35
      end
36
      assert_equal state.image, docker_image
37
    end
38 3bc253a2 David Davis
  end
39
end