1
|
require 'test_plugin_helper'
|
2
|
|
3
|
module Containers
|
4
|
class StepsControllerTest < ActionController::TestCase
|
5
|
setup do
|
6
|
@container = FactoryGirl.create(:container)
|
7
|
end
|
8
|
|
9
|
test 'wizard finishes with a redirect to the managed container' do
|
10
|
state = DockerContainerWizardState.create!
|
11
|
Service::Containers.any_instance.expects(:start_container!).with(equals(state))
|
12
|
.returns(@container)
|
13
|
put :update, { :wizard_state_id => state.id,
|
14
|
:id => :environment,
|
15
|
:docker_container_wizard_states_environment => { :tty => false } },
|
16
|
set_session_user
|
17
|
|
18
|
assert_redirected_to container_path(:id => @container.id)
|
19
|
end
|
20
|
|
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")
|
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
|
end
|
39
|
end
|