Sha256: 9d8687792ed27b1190da1b2be9556676800f0bf41c6f1c8751751b0bb9f260e4

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

TEST_DIR = File.dirname(File.expand_path(__FILE__))
LIB_DIR = File.join(TEST_DIR, '..', 'lib', 'cveparser')

$LOAD_PATH.unshift LIB_DIR
require 'parser'
require 'test/unit'

# Tests the parsing funcionality of the NVD parser.
class TestCveParser < Test::Unit::TestCase
  
  include FIDIUS::NVDParser
  
  def test_should_parse_2_0_only
    assert_raise(RuntimeError) { FIDIUS::NVDParser.parse_cve_file(
                                 File.join(TEST_DIR, 'test_v2.xml')) }
  end
  
  def test_should_find_1_reference
    entries = FIDIUS::NVDParser.parse_cve_file(
                File.join(TEST_DIR, 'test_references.xml'))
    assert_equal 1, entries.first.references.size, "The test_references.xml " +
        "contains one reference which should be found."
  end
  
  def test_should_find_3_nvd_entries
    entries = FIDIUS::NVDParser.parse_cve_file(
                File.join(TEST_DIR, 'test_3_entries.xml'))
    assert_equal 3, entries.size, "The test_entries.xml contains 3 NVD " +
        "entries which should be returned in an array."
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fidius-cvedb-0.0.8 test/cve_parser_test.rb
fidius-cvedb-0.0.7 test/cve_parser_test.rb