blob: 3bbdf619a8c5c47460f20e249f7d4846ed72d57d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# frozen_string_literal: true
require "spec_helper"
RSpec.describe Enums::Sbom, feature_category: :dependency_management do
using RSpec::Parameterized::TableSyntax
describe '.purl_types' do
subject(:actual_purl_type) { described_class.purl_types[package_manager] }
where(:given_package_manager, :expected_purl_type) do
:composer | 1
'composer' | 1
:conan | 2
'conan' | 2
:gem | 3
:golang | 4
:maven | 5
:npm | 6
:nuget | 7
:pypi | 8
:apk | 9
:rpm | 10
:deb | 11
'cbl-mariner' | 12
:wolfi | 13
'unknown-pkg-manager' | 0
'Python (unknown)' | 0
end
with_them do
let(:package_manager) { given_package_manager }
it 'returns the expected purl_type' do
expect(actual_purl_type).to eql(expected_purl_type)
end
end
it 'contains all of the dependency scanning and container scanning purl types' do
expect(described_class::DEPENDENCY_SCANNING_PURL_TYPES + described_class::CONTAINER_SCANNING_PURL_TYPES)
.to eql(described_class::PURL_TYPES.keys)
end
end
describe '.dependency_scanning_purl_type?' do
where(:purl_type, :expected) do
:composer | false
'composer' | true
'conan' | true
'gem' | true
'golang' | true
'maven' | true
'npm' | true
'nuget' | true
'pypi' | true
'unknown' | false
'apk' | false
'rpm' | false
'deb' | false
'wolfi' | false
end
with_them do
it 'returns true if the purl_type is for dependency_scanning' do
actual = described_class.dependency_scanning_purl_type?(purl_type)
expect(actual).to eql(expected)
end
end
end
describe '.container_scanning_purl_type?' do
where(:purl_type, :expected) do
'composer' | false
'conan' | false
'gem' | false
'golang' | false
'maven' | false
'npm' | false
'nuget' | false
'pypi' | false
'unknown' | false
:apk | false
'apk' | true
'rpm' | true
'deb' | true
'cbl-mariner' | true
'wolfi' | true
end
with_them do
it 'returns true if the purl_type is for container_scanning' do
actual = described_class.container_scanning_purl_type?(purl_type)
expect(actual).to eql(expected)
end
end
end
end
|