Sha256: 1c1c2d2822a527932ca0e0e0316f07209a50c55384242a8cc7aea328aabc9a04

Contents?: true

Size: 1.34 KB

Versions: 11

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe 'Openvas upload plugin' do
  describe 'importer' do
    before(:each) do
      # Stub template service
      templates_dir = File.expand_path('../../../templates', __FILE__)
      expect_any_instance_of(Dradis::Plugins::TemplateService)
      .to receive(:default_templates_dir).and_return(templates_dir)

      plugin = Dradis::Plugins::OpenVAS

      @content_service = Dradis::Plugins::ContentService::Base.new(plugin: plugin)

      allow(@content_service).to receive(:create_note) do |args|
        OpenStruct.new(args)
      end
      allow(@content_service).to receive(:create_node) do |args|
        OpenStruct.new(args)
      end
      allow(@content_service).to receive(:create_issue) do |args|
        OpenStruct.new(args)
      end
      allow(@content_service).to receive(:create_evidence) do |args|
        OpenStruct.new(args)
      end

      @importer = plugin::Importer.new(
        content_service: @content_service
      )
    end

    context 'Openvas v24 output' do
      it 'parses node label without hostname' do
        expect(@content_service).to receive(:create_node) do |args|
          expect(args[:label]).to eq('188.111.11.85')
          expect(args[:type]).to eq(:host)
        end

        @importer.import(file: File.expand_path('../fixtures/files/report_v24.xml', __dir__))
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dradis-openvas-4.14.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.13.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.11.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.10.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.9.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.8.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.7.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.6.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.5.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.4.0 spec/openvas/upload_v24_spec.rb
dradis-openvas-4.3.0 spec/openvas/upload_v24_spec.rb