openscap 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,7 @@ class TestSds < OpenSCAP::TestCase
44
44
  sds = new_sds
45
45
  benchmark_source = sds.select_checklist!
46
46
  benchmark = OpenSCAP::Xccdf::Benchmark.new benchmark_source
47
- benchmark.profiles.keys.each do |id|
47
+ benchmark.profiles.each_key do |id|
48
48
  guide = sds.html_guide id
49
49
  assert !guide.nil?
50
50
  assert guide.include?(id)
@@ -0,0 +1,53 @@
1
+ #
2
+ # Copyright (c) 2014--2016 Red Hat Inc.
3
+ #
4
+ # This software is licensed to you under the GNU General Public License,
5
+ # version 2 (GPLv2). There is NO WARRANTY for this software, express or
6
+ # implied, including the implied warranties of MERCHANTABILITY or FITNESS
7
+ # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
8
+ # along with this software; if not, see
9
+ # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
10
+ #
11
+
12
+ require 'common/testcase'
13
+ require 'openscap'
14
+ require 'openscap/ds/sds'
15
+ require 'openscap/source'
16
+ require 'openscap/xccdf/benchmark'
17
+
18
+ class TestArf < OpenSCAP::TestCase
19
+ def test_new_from_file
20
+ b = benchmark_from_arf_file
21
+ b.destroy
22
+ end
23
+
24
+ def test_idents
25
+ b = benchmark_from_arf_file
26
+ item = b.items['xccdf_com.redhat.rhsa_rule_oval-com.redhat.rhsa-def-20140675']
27
+ idents = item.idents
28
+ assert idents.size == 25
29
+ end
30
+
31
+ def test_ident_title_url
32
+ b = benchmark_from_arf_file
33
+ item = b.items['xccdf_com.redhat.rhsa_rule_oval-com.redhat.rhsa-def-20140678']
34
+ idents = item.idents
35
+ assert idents.size == 2
36
+ ident = idents[0]
37
+ expected_id = 'RHSA-2014-0678'
38
+ expected_system = 'https://rhn.redhat.com/errata'
39
+ assert_equal(expected_id, ident.id)
40
+ assert_equal(expected_system, ident.system)
41
+ end
42
+
43
+ private
44
+
45
+ def benchmark_from_arf_file
46
+ arf = OpenSCAP::DS::Arf.new('../data/arf.xml')
47
+ _test_results = arf.test_result
48
+ source_datastream = arf.report_request
49
+ bench_source = source_datastream.select_checklist!
50
+ benchmark = OpenSCAP::Xccdf::Benchmark.new(bench_source)
51
+ benchmark
52
+ end
53
+ end
@@ -44,20 +44,20 @@ class TestTestResult < OpenSCAP::TestCase
44
44
  assert tr.rr.size == 28
45
45
  assert tr.rr.key?('xccdf_org.ssgproject.content_rule_disable_prelink')
46
46
  assert tr.rr.key?('xccdf_org.ssgproject.content_rule_no_direct_root_logins')
47
- assert 'fail' == tr.rr['xccdf_org.ssgproject.content_rule_disable_prelink'].result
48
- assert 'notchecked' == tr.rr['xccdf_org.ssgproject.content_rule_no_direct_root_logins'].result
47
+ assert tr.rr['xccdf_org.ssgproject.content_rule_disable_prelink'].result == 'fail'
48
+ assert tr.rr['xccdf_org.ssgproject.content_rule_no_direct_root_logins'].result == 'notchecked'
49
49
  tr.destroy
50
50
  end
51
51
 
52
52
  def test_override
53
53
  tr = new_tr
54
54
  rr = tr.rr['xccdf_org.ssgproject.content_rule_disable_prelink']
55
- assert 'fail' == rr.result
55
+ assert rr.result == 'fail'
56
56
  rr.override!(:new_result => :pass,
57
57
  :time => 'yesterday',
58
58
  :authority => 'John Hacker',
59
59
  :raw_text => 'We are testing prelink on this machine')
60
- assert 'pass' == rr.result
60
+ assert rr.result == 'pass'
61
61
  tr.destroy
62
62
  end
63
63
 
@@ -75,12 +75,12 @@ class TestTestResult < OpenSCAP::TestCase
75
75
  assert_default_score tr.score!(benchmark), 34, 35
76
76
 
77
77
  rr = tr.rr['xccdf_org.ssgproject.content_rule_disable_prelink']
78
- assert 'fail' == rr.result
78
+ assert rr.result == 'fail'
79
79
  rr.override!(:new_result => :pass,
80
80
  :time => 'yesterday',
81
81
  :authority => 'John Hacker',
82
82
  :raw_text => 'We are testing prelink on this machine')
83
- assert 'pass' == rr.result
83
+ assert rr.result == 'pass'
84
84
 
85
85
  assert_default_score tr.score, 34, 35
86
86
  assert_default_score tr.score!(benchmark), 47, 48
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Lukasik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-18 00:00:00.000000000 Z
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,6 +63,7 @@ files:
63
63
  - lib/openscap/xccdf/benchmark.rb
64
64
  - lib/openscap/xccdf/fix.rb
65
65
  - lib/openscap/xccdf/group.rb
66
+ - lib/openscap/xccdf/ident.rb
66
67
  - lib/openscap/xccdf/item.rb
67
68
  - lib/openscap/xccdf/policy.rb
68
69
  - lib/openscap/xccdf/policy_model.rb
@@ -75,6 +76,7 @@ files:
75
76
  - lib/openscap/xccdf/testresult.rb
76
77
  - lib/openscap/xccdf/value.rb
77
78
  - test/common/testcase.rb
79
+ - test/data/arf.xml
78
80
  - test/data/invalid.xml
79
81
  - test/data/sds-complex.xml
80
82
  - test/data/tailoring.xml
@@ -86,6 +88,7 @@ files:
86
88
  - test/openscap_test.rb
87
89
  - test/source_test.rb
88
90
  - test/text_test.rb
91
+ - test/xccdf/arf_test.rb
89
92
  - test/xccdf/benchmark_test.rb
90
93
  - test/xccdf/policy_test.rb
91
94
  - test/xccdf/profile_test.rb
@@ -113,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
116
  version: '0'
114
117
  requirements: []
115
118
  rubyforge_project:
116
- rubygems_version: 2.4.8
119
+ rubygems_version: 2.6.14.1
117
120
  signing_key:
118
121
  specification_version: 4
119
122
  summary: A FFI wrapper around the OpenSCAP library