|
1 | | -# Copyright (c) 2017 nexB Inc. and others. All rights reserved. |
2 | | -# http://nexb.com and https://github.com/nexB/vulnerablecode/ |
3 | | -# The VulnerableCode software is licensed under the Apache License version 2.0. |
4 | | -# Data generated with VulnerableCode require an acknowledgment. |
5 | | -# |
6 | | -# You may not use this software except in compliance with the License. |
7 | | -# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 |
8 | | -# Unless required by applicable law or agreed to in writing, software distributed |
9 | | -# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
10 | | -# CONDITIONS OF ANY KIND, either express or implied. See the License for the |
11 | | -# specific language governing permissions and limitations under the License. |
12 | | -# |
13 | | -# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode |
14 | | -# derivative work, you must accompany this data with the following acknowledgment: |
15 | | -# |
16 | | -# Generated with VulnerableCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES |
17 | | -# OR CONDITIONS OF ANY KIND, either express or implied. No content created from |
18 | | -# VulnerableCode should be considered or used as legal advice. Consult an Attorney |
19 | | -# for any legal advice. |
20 | | -# VulnerableCode is a free software code scanning tool from nexB Inc. and others. |
21 | | -# Visit https://github.com/nexB/vulnerablecode/ for support and download. |
| 1 | +# # Copyright (c) 2017 nexB Inc. and others. All rights reserved. |
| 2 | +# # http://nexb.com and https://github.com/nexB/vulnerablecode/ |
| 3 | +# # The VulnerableCode software is licensed under the Apache License version 2.0. |
| 4 | +# # Data generated with VulnerableCode require an acknowledgment. |
| 5 | +# # |
| 6 | +# # You may not use this software except in compliance with the License. |
| 7 | +# # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 |
| 8 | +# # Unless required by applicable law or agreed to in writing, software distributed |
| 9 | +# # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 10 | +# # CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 11 | +# # specific language governing permissions and limitations under the License. |
| 12 | +# # |
| 13 | +# # When you publish or redistribute any data created with VulnerableCode or any VulnerableCode |
| 14 | +# # derivative work, you must accompany this data with the following acknowledgment: |
| 15 | +# # |
| 16 | +# # Generated with VulnerableCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES |
| 17 | +# # OR CONDITIONS OF ANY KIND, either express or implied. No content created from |
| 18 | +# # VulnerableCode should be considered or used as legal advice. Consult an Attorney |
| 19 | +# # for any legal advice. |
| 20 | +# # VulnerableCode is a free software code scanning tool from nexB Inc. and others. |
| 21 | +# # Visit https://github.com/nexB/vulnerablecode/ for support and download. |
22 | 22 |
|
23 | | -from collections import OrderedDict |
24 | | -import os |
25 | | -from unittest import TestCase |
26 | | -import yaml |
| 23 | +# from collections import OrderedDict |
| 24 | +# import os |
| 25 | +# from unittest import TestCase |
| 26 | +# import yaml |
27 | 27 |
|
28 | | -from packageurl import PackageURL |
| 28 | +# from packageurl import PackageURL |
29 | 29 |
|
30 | | -from vulnerabilities.importers.suse_backports import SUSEBackportsDataSource |
31 | | -from vulnerabilities.data_source import Advisory |
| 30 | +# from vulnerabilities.importers.suse_backports import SUSEBackportsDataSource |
| 31 | +# from vulnerabilities.data_source import Advisory |
32 | 32 |
|
33 | | -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 33 | +# BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
34 | 34 |
|
35 | 35 |
|
36 | | -def yaml_loader(): |
37 | | - path = os.path.join(BASE_DIR, "test_data/suse_backports/") |
38 | | - yaml_files = {} |
39 | | - for file in os.listdir(path): |
40 | | - with open(os.path.join(path, file)) as f: |
41 | | - yaml_files[file] = yaml.safe_load(f) |
42 | | - return yaml_files |
| 36 | +# def yaml_loader(): |
| 37 | +# path = os.path.join(BASE_DIR, "test_data/suse_backports/") |
| 38 | +# yaml_files = {} |
| 39 | +# for file in os.listdir(path): |
| 40 | +# with open(os.path.join(path, file)) as f: |
| 41 | +# yaml_files[file] = yaml.safe_load(f) |
| 42 | +# return yaml_files |
43 | 43 |
|
44 | 44 |
|
45 | | -class TestSUSEBackportsDataSource(TestCase): |
46 | | - @classmethod |
47 | | - def setUpClass(cls): |
48 | | - data_source_cfg = {"url": "https://endpoint.com", "etags": {}} |
49 | | - cls.data_src = SUSEBackportsDataSource(1, config=data_source_cfg) |
| 45 | +# class TestSUSEBackportsDataSource(TestCase): |
| 46 | +# @classmethod |
| 47 | +# def setUpClass(cls): |
| 48 | +# data_source_cfg = {"url": "https://endpoint.com", "etags": {}} |
| 49 | +# cls.data_src = SUSEBackportsDataSource(1, config=data_source_cfg) |
50 | 50 |
|
51 | | - def test_process_file(self): |
52 | | - parsed_yamls = yaml_loader() |
53 | | - expected_data = [ |
54 | | - Advisory( |
55 | | - summary="", |
56 | | - impacted_package_urls=[], |
57 | | - resolved_package_urls=[ |
58 | | - PackageURL( |
59 | | - type="rpm", |
60 | | - namespace="opensuse", |
61 | | - name="MozillaFirefox", |
62 | | - version="3.0.10-1.1.1", |
63 | | - qualifiers=OrderedDict(), |
64 | | - subpath=None, |
65 | | - ) |
66 | | - ], |
67 | | - vulnerability_id="CVE-2009-1313", |
68 | | - ), |
69 | | - Advisory( |
70 | | - summary="", |
71 | | - impacted_package_urls=[], |
72 | | - resolved_package_urls=[ |
73 | | - PackageURL( |
74 | | - type="rpm", |
75 | | - namespace="opensuse", |
76 | | - name="MozillaFirefox-branding-SLED", |
77 | | - version="3.5-1.1.5", |
78 | | - qualifiers=OrderedDict(), |
79 | | - subpath=None, |
80 | | - ) |
81 | | - ], |
82 | | - vulnerability_id="CVE-2009-1313", |
83 | | - ), |
84 | | - Advisory( |
85 | | - summary="", |
86 | | - impacted_package_urls=[], |
87 | | - resolved_package_urls=[ |
88 | | - PackageURL( |
89 | | - type="rpm", |
90 | | - namespace="opensuse", |
91 | | - name="MozillaFirefox-translations", |
92 | | - version="3.0.10-1.1.1", |
93 | | - qualifiers=OrderedDict(), |
94 | | - subpath=None, |
95 | | - ) |
96 | | - ], |
97 | | - vulnerability_id="CVE-2009-1313", |
98 | | - ), |
99 | | - Advisory( |
100 | | - summary="", |
101 | | - impacted_package_urls=[], |
102 | | - resolved_package_urls=[ |
103 | | - PackageURL( |
104 | | - type="rpm", |
105 | | - namespace="opensuse", |
106 | | - name="NetworkManager", |
107 | | - version="0.7.0.r4359-15.9.2", |
108 | | - qualifiers=OrderedDict(), |
109 | | - subpath=None, |
110 | | - ) |
111 | | - ], |
112 | | - vulnerability_id="CVE-2009-0365", |
113 | | - ), |
114 | | - Advisory( |
115 | | - summary="", |
116 | | - impacted_package_urls=[], |
117 | | - resolved_package_urls=[ |
118 | | - PackageURL( |
119 | | - type="rpm", |
120 | | - namespace="opensuse", |
121 | | - name="NetworkManager", |
122 | | - version="0.7.0.r4359-15.9.2", |
123 | | - qualifiers=OrderedDict(), |
124 | | - subpath=None, |
125 | | - ) |
126 | | - ], |
127 | | - vulnerability_id="CVE-2009-0578", |
128 | | - ), |
129 | | - ] |
| 51 | +# def test_process_file(self): |
| 52 | +# parsed_yamls = yaml_loader() |
| 53 | +# expected_data = [ |
| 54 | +# Advisory( |
| 55 | +# summary="", |
| 56 | +# impacted_package_urls=[], |
| 57 | +# resolved_package_urls=[ |
| 58 | +# PackageURL( |
| 59 | +# type="rpm", |
| 60 | +# namespace="opensuse", |
| 61 | +# name="MozillaFirefox", |
| 62 | +# version="3.0.10-1.1.1", |
| 63 | +# qualifiers=OrderedDict(), |
| 64 | +# subpath=None, |
| 65 | +# ) |
| 66 | +# ], |
| 67 | +# vulnerability_id="CVE-2009-1313", |
| 68 | +# ), |
| 69 | +# Advisory( |
| 70 | +# summary="", |
| 71 | +# impacted_package_urls=[], |
| 72 | +# resolved_package_urls=[ |
| 73 | +# PackageURL( |
| 74 | +# type="rpm", |
| 75 | +# namespace="opensuse", |
| 76 | +# name="MozillaFirefox-branding-SLED", |
| 77 | +# version="3.5-1.1.5", |
| 78 | +# qualifiers=OrderedDict(), |
| 79 | +# subpath=None, |
| 80 | +# ) |
| 81 | +# ], |
| 82 | +# vulnerability_id="CVE-2009-1313", |
| 83 | +# ), |
| 84 | +# Advisory( |
| 85 | +# summary="", |
| 86 | +# impacted_package_urls=[], |
| 87 | +# resolved_package_urls=[ |
| 88 | +# PackageURL( |
| 89 | +# type="rpm", |
| 90 | +# namespace="opensuse", |
| 91 | +# name="MozillaFirefox-translations", |
| 92 | +# version="3.0.10-1.1.1", |
| 93 | +# qualifiers=OrderedDict(), |
| 94 | +# subpath=None, |
| 95 | +# ) |
| 96 | +# ], |
| 97 | +# vulnerability_id="CVE-2009-1313", |
| 98 | +# ), |
| 99 | +# Advisory( |
| 100 | +# summary="", |
| 101 | +# impacted_package_urls=[], |
| 102 | +# resolved_package_urls=[ |
| 103 | +# PackageURL( |
| 104 | +# type="rpm", |
| 105 | +# namespace="opensuse", |
| 106 | +# name="NetworkManager", |
| 107 | +# version="0.7.0.r4359-15.9.2", |
| 108 | +# qualifiers=OrderedDict(), |
| 109 | +# subpath=None, |
| 110 | +# ) |
| 111 | +# ], |
| 112 | +# vulnerability_id="CVE-2009-0365", |
| 113 | +# ), |
| 114 | +# Advisory( |
| 115 | +# summary="", |
| 116 | +# impacted_package_urls=[], |
| 117 | +# resolved_package_urls=[ |
| 118 | +# PackageURL( |
| 119 | +# type="rpm", |
| 120 | +# namespace="opensuse", |
| 121 | +# name="NetworkManager", |
| 122 | +# version="0.7.0.r4359-15.9.2", |
| 123 | +# qualifiers=OrderedDict(), |
| 124 | +# subpath=None, |
| 125 | +# ) |
| 126 | +# ], |
| 127 | +# vulnerability_id="CVE-2009-0578", |
| 128 | +# ), |
| 129 | +# ] |
130 | 130 |
|
131 | | - found_data = self.data_src.process_file(parsed_yamls["backports-sle11-sp0.yaml"]) |
| 131 | +# found_data = self.data_src.process_file(parsed_yamls["backports-sle11-sp0.yaml"]) |
132 | 132 |
|
133 | | - found_advisories = list(map(Advisory.normalized, found_data)) |
134 | | - expected_advisories = list(map(Advisory.normalized, expected_data)) |
135 | | - assert sorted(found_advisories) == sorted(expected_advisories) |
| 133 | +# found_advisories = list(map(Advisory.normalized, found_data)) |
| 134 | +# expected_advisories = list(map(Advisory.normalized, expected_data)) |
| 135 | +# assert sorted(found_advisories) == sorted(expected_advisories) |
0 commit comments