Sha256: 7434f76487105386bdb148b3cd3799c77fe8c7aaa258d247d34a6c40c9fcb3d7

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

require 'test_plugin_helper'

class TailoringFilesControllerTest < ActionController::TestCase
  setup do
    @tailoring_file = FactoryGirl.create(:tailoring_file)
    @scap_file = File.new("#{ForemanOpenscap::Engine.root}/test/files/tailoring_files/ssg-firefox-ds-tailoring.xml", 'rb')
  end

  test 'index' do
    get :index, {}, set_session_user
    assert_template 'index'
  end

  test 'new' do
    get :new, {}, set_session_user
    assert_template 'new'
  end

  test 'edit' do
    get :edit, { :id => @tailoring_file.id }, set_session_user
    assert_template 'edit'
  end

  test 'create' do
    uploaded_file = ActionDispatch::Http::UploadedFile.new(:tempfile => @scap_file,
                                                           :content_type => 'text/xml')
    uploaded_file.original_filename = 'uploaded-tailoring-file.xml'
    post :create, { :tailoring_file => { :name => 'some_file', :scap_file => uploaded_file } }, set_session_user
    assert_redirected_to tailoring_files_url
  end

  test 'destroy' do
    tf = ForemanOpenscap::TailoringFile.first
    delete :destroy, { :id => tf.id }, set_session_user
    assert_redirected_to tailoring_files_url
    refute ForemanOpenscap::TailoringFile.exists?(tf.id)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
foreman_openscap-0.7.13 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.12 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.11 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.10 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.9 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.8 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.7 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.6 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.8.1 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.5 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.8.0 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.4 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.3 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.2 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.1 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.6.7 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.7.0 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.6.6 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.6.5 test/functional/tailoring_files_controller_test.rb
foreman_openscap-0.6.4 test/functional/tailoring_files_controller_test.rb