|
4 | 4 |
|
5 | 5 | class ProfilesTest < Minitest::Test |
6 | 6 | describe 'profiles are parsed from' do |
7 | | - include OpenscapParser::Profiles |
8 | | - include OpenscapParser::XMLReport |
| 7 | + class TestParser |
| 8 | + include OpenscapParser::Profiles |
| 9 | + include OpenscapParser::XMLReport |
| 10 | + include OpenscapParser::TestResult |
9 | 11 |
|
10 | | - def report_description |
11 | | - 'description' |
| 12 | + def report_description |
| 13 | + 'description' |
| 14 | + end |
12 | 15 | end |
13 | 16 |
|
14 | 17 | def setup |
15 | 18 | @profiles = nil |
16 | 19 | end |
17 | 20 |
|
18 | 21 | test 'standard fedora' do |
19 | | - def test_result_node |
20 | | - OpenStruct.new(id: ['xccdf_org.ssgproject.content_profile_standard']) |
| 22 | + class TestParser |
| 23 | + def test_result_profile_id |
| 24 | + 'xccdf_org.ssgproject.content_profile_standard' |
| 25 | + end |
21 | 26 | end |
22 | 27 |
|
23 | | - report_xml(file_fixture('xccdf_report.xml').read) |
| 28 | + test_parser = TestParser.new |
| 29 | + |
| 30 | + test_parser.parsed_xml(file_fixture('xccdf_report.xml').read) |
24 | 31 |
|
25 | 32 | expected = { |
26 | 33 | 'xccdf_org.ssgproject.content_profile_standard' => \ |
27 | 34 | 'Standard System Security Profile for Fedora' |
28 | 35 | } |
29 | | - assert_equal expected, profiles |
| 36 | + assert_equal expected, test_parser.test_result_profiles |
30 | 37 | end |
31 | 38 |
|
32 | 39 | test 'ospp42 rhel' do |
33 | | - def test_result_node |
34 | | - OpenStruct.new(id: ['xccdf_org.open-scap_testresult_xccdf_org.'\ |
35 | | - 'ssgproject.content_profile_ospp42']) |
| 40 | + class TestParser |
| 41 | + def test_result_profile_id |
| 42 | + 'xccdf_org.ssgproject.content_profile_ospp42' |
| 43 | + end |
36 | 44 | end |
37 | 45 |
|
38 | | - report_xml(file_fixture('rhel-xccdf-report.xml').read) |
| 46 | + test_parser = TestParser.new |
| 47 | + |
| 48 | + test_parser.parsed_xml(file_fixture('rhel-xccdf-report.xml').read) |
39 | 49 |
|
40 | 50 | expected = { |
41 | 51 | 'xccdf_org.ssgproject.content_profile_ospp42' => 'OSPP - Protection '\ |
42 | 52 | 'Profile for General Purpose Operating Systems v. 4.2' |
43 | 53 | } |
44 | | - assert_equal expected, profiles |
| 54 | + assert_equal expected, test_parser.test_result_profiles |
45 | 55 | end |
46 | 56 | end |
47 | 57 | end |
0 commit comments