Sha256: a7a703c28100f9c3083d9b347d9938ecd2979c89762a4e1a4bb3aedda652125d
Contents?: true
Size: 1.76 KB
Versions: 22
Compression:
Stored size: 1.76 KB
Contents
require 'test_plugin_helper' class Api::V2::Compliance::ScapContentsControllerTest < ActionController::TestCase test "should get index" do FactoryGirl.create(:scap_content) get :index, {}, set_session_user response = ActiveSupport::JSON.decode(@response.body) assert response['results'].any? assert_response :success end test "should return xml of scap content" do scap_content = FactoryGirl.create(:scap_content) get :show, { :id => scap_content.id }, set_session_user assert(@response.header['Content-Type'], 'application/xml') assert_response :success end test "should not create invalid scap content" do post :create, {}, set_session_user assert_response :unprocessable_entity end test "should create scap content" do # Skipped as API does not support uploading files end test "should update scap content" do scap_content = FactoryGirl.create(:scap_content) put :update, { :id => scap_content.id, :scap_content => {:title => 'RHEL7 SCAP'}}, set_session_user assert_response :success assert scap_content.title, 'RHEL7 SCAP' end test "should not update invalid scap content" do skip("Solve 'ActiveRecord::RecordInvalid' error") ProxyAPI::Openscap.any_instance.stubs(:validate_scap_content).returns({'errors' => ['Invalid file']}) scap_content = FactoryGirl.create(:scap_content) put :update, { :id => scap_content.id, :scap_content => {:scap_file => '<xml>blah</xml>'}}, set_session_user assert_response :unprocessable_entity end test "should destory scap content" do scap_content = FactoryGirl.create(:scap_content) delete :destroy, { :id => scap_content.id }, set_session_user assert_response :ok refute ForemanOpenscap::ScapContent.exists?(scap_content.id) end end
Version data entries
22 entries across 22 versions & 1 rubygems