Sha256: cd5c1e4d0b737cade13af536ce3756b6a9568eeb64e9be4ee079fb0fecf8fd79
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'test_plugin_helper' module Api module V2 class JobInvocationsControllerTest < ActionController::TestCase setup do @invocation = FactoryGirl.create(:job_invocation, :with_template) @template = FactoryGirl.create(:job_template, :with_input) end test "should get index" do get :index invocations = ActiveSupport::JSON.decode(@response.body) refute_empty invocations, "Should response with invocation" assert_response :success end test "should get invocation detail" do get :show, :id => @invocation.id assert_response :success template = ActiveSupport::JSON.decode(@response.body) refute_empty template assert_equal template["job_name"], @invocation.job_name end test "should create valid without template_id" do attrs = { :job_name => @template.job_name, :name => 'RandomName', :targeting_type => 'static_query', :search_query => "foobar"} post :create, :job_invocation => attrs invocation = ActiveSupport::JSON.decode(@response.body) assert_equal attrs[:job_name], invocation['job_name'] assert_response :success end test "should create valid with template_id" do attrs = { :job_name => @template.job_name, :name => 'RandomName', :template_id => @template.id,:targeting_type => 'static_query', :search_query => "foobar"} post :create, :job_invocation => attrs invocation = ActiveSupport::JSON.decode(@response.body) assert_equal attrs[:job_name], invocation['job_name'] assert_response :success end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_remote_execution-0.1.1 | test/functional/api/v2/job_invocations_controller_test.rb |
foreman_remote_execution-0.1.0 | test/functional/api/v2/job_invocations_controller_test.rb |