2727
2828from vulnerabilities .scraper import debian
2929from vulnerabilities .scraper import ubuntu
30+ from vulnerabilities .scraper import archlinux
3031
3132
3233def test_ubuntu_extract_cves ():
@@ -93,3 +94,182 @@ def test_debian_extract_vulnerabilities():
9394 ]
9495
9596 assert expected == debian .extract_vulnerabilities (test_data )
97+
98+
99+ def test_archlinux_extract_vulnerabilities ():
100+ archlinux_test_file = join (dirname (__file__ ), 'test_data' , 'archlinux.json' )
101+
102+ with open (archlinux_test_file ) as f :
103+ test_data = json .loads (f .read ())
104+
105+ G = archlinux .extract_vulnerabilities (test_data )
106+
107+ expected = [
108+ {
109+ 'package_name' : 'libarchive' ,
110+ 'vulnerability_id' : 'CVE-2019-1000020' ,
111+ 'description' : 'multiple issues' ,
112+ 'status' : 'Vulnerable' ,
113+ 'severity' : 'High' ,
114+ 'version' : '3.3.3-1'
115+ },
116+ {
117+ 'package_name' : 'libarchive' ,
118+ 'vulnerability_id' : 'CVE-2019-1000019' ,
119+ 'description' : 'multiple issues' ,
120+ 'status' : 'Vulnerable' ,
121+ 'severity' : 'High' ,
122+ 'version' : '3.3.3-1'
123+ },
124+ {
125+ 'package_name' : 'libarchive' ,
126+ 'vulnerability_id' : 'CVE-2018-1000880' ,
127+ 'description' : 'multiple issues' ,
128+ 'status' : 'Vulnerable' ,
129+ 'severity' : 'High' ,
130+ 'version' : '3.3.3-1'
131+ },
132+ {
133+ 'package_name' : 'libarchive' ,
134+ 'vulnerability_id' : 'CVE-2018-1000879' ,
135+ 'description' : 'multiple issues' ,
136+ 'status' : 'Vulnerable' ,
137+ 'severity' : 'High' ,
138+ 'version' : '3.3.3-1'
139+ },
140+ {
141+ 'package_name' : 'libarchive' ,
142+ 'vulnerability_id' : 'CVE-2018-1000878' ,
143+ 'description' : 'multiple issues' ,
144+ 'status' : 'Vulnerable' ,
145+ 'severity' : 'High' ,
146+ 'version' : '3.3.3-1'
147+ },
148+ {
149+ 'package_name' : 'libarchive' ,
150+ 'vulnerability_id' : 'CVE-2018-1000877' ,
151+ 'description' : 'multiple issues' ,
152+ 'status' : 'Vulnerable' ,
153+ 'severity' : 'High' ,
154+ 'version' : '3.3.3-1'
155+ },
156+ {
157+ 'package_name' : 'libarchive' ,
158+ 'vulnerability_id' : 'CVE-2019-1000020' ,
159+ 'description' : 'multiple issues' ,
160+ 'status' : 'Vulnerable' ,
161+ 'severity' : 'High' ,
162+ 'version' : '3.3.3-2'
163+ },
164+ {
165+ 'package_name' : 'libarchive' ,
166+ 'vulnerability_id' : 'CVE-2019-1000019' ,
167+ 'description' : 'multiple issues' ,
168+ 'status' : 'Vulnerable' ,
169+ 'severity' : 'High' ,
170+ 'version' : '3.3.3-2'
171+ },
172+ {
173+ 'package_name' : 'libarchive' ,
174+ 'vulnerability_id' : 'CVE-2018-1000880' ,
175+ 'description' : 'multiple issues' ,
176+ 'status' : 'Vulnerable' ,
177+ 'severity' : 'High' ,
178+ 'version' : '3.3.3-2'
179+ },
180+ {
181+ 'package_name' : 'libarchive' ,
182+ 'vulnerability_id' : 'CVE-2018-1000879' ,
183+ 'description' : 'multiple issues' ,
184+ 'status' : 'Vulnerable' ,
185+ 'severity' : 'High' ,
186+ 'version' : '3.3.3-2'
187+ },
188+ {
189+ 'package_name' : 'libarchive' ,
190+ 'vulnerability_id' : 'CVE-2018-1000878' ,
191+ 'description' : 'multiple issues' ,
192+ 'status' : 'Vulnerable' ,
193+ 'severity' : 'High' ,
194+ 'version' : '3.3.3-2'
195+ },
196+ {
197+ 'package_name' : 'libarchive' ,
198+ 'vulnerability_id' : 'CVE-2018-1000877' ,
199+ 'description' : 'multiple issues' ,
200+ 'status' : 'Vulnerable' ,
201+ 'severity' : 'High' ,
202+ 'version' : '3.3.3-2'
203+ }
204+ ]
205+
206+ assert expected == next (G )
207+
208+ expected = [
209+ {
210+ 'package_name' : 'python2-django' ,
211+ 'vulnerability_id' : 'CVE-2016-9014' ,
212+ 'description' : 'multiple issues' ,
213+ 'status' : 'Fixed' ,
214+ 'severity' : 'High' ,
215+ 'version' : '1.10.2-1'
216+ },
217+ {
218+ 'package_name' : 'python2-django' ,
219+ 'vulnerability_id' : 'CVE-2016-9013' ,
220+ 'description' : 'multiple issues' ,
221+ 'status' : 'Fixed' ,
222+ 'severity' : 'High' ,
223+ 'version' : '1.10.2-1'
224+ },
225+ {
226+ 'package_name' : 'python2-django' ,
227+ 'vulnerability_id' : 'CVE-2016-9014' ,
228+ 'description' : 'multiple issues' ,
229+ 'status' : 'Fixed' ,
230+ 'severity' : 'High' ,
231+ 'version' : '1.10.3-1'
232+ },
233+ {
234+ 'package_name' : 'python2-django' ,
235+ 'vulnerability_id' : 'CVE-2016-9013' ,
236+ 'description' : 'multiple issues' ,
237+ 'status' : 'Fixed' ,
238+ 'severity' : 'High' ,
239+ 'version' : '1.10.3-1'
240+ },
241+ {
242+ 'package_name' : 'python-django' ,
243+ 'vulnerability_id' : 'CVE-2016-9014' ,
244+ 'description' : 'multiple issues' ,
245+ 'status' : 'Fixed' ,
246+ 'severity' : 'High' ,
247+ 'version' : '1.10.2-1'
248+ },
249+ {
250+ 'package_name' : 'python-django' ,
251+ 'vulnerability_id' : 'CVE-2016-9013' ,
252+ 'description' : 'multiple issues' ,
253+ 'status' : 'Fixed' ,
254+ 'severity' : 'High' ,
255+ 'version' : '1.10.2-1'
256+ },
257+ {
258+ 'package_name' : 'python-django' ,
259+ 'vulnerability_id' : 'CVE-2016-9014' ,
260+ 'description' : 'multiple issues' ,
261+ 'status' : 'Fixed' ,
262+ 'severity' : 'High' ,
263+ 'version' : '1.10.3-1'
264+ },
265+ {
266+ 'package_name' : 'python-django' ,
267+ 'vulnerability_id' : 'CVE-2016-9013' ,
268+ 'description' : 'multiple issues' ,
269+ 'status' : 'Fixed' ,
270+ 'severity' : 'High' ,
271+ 'version' : '1.10.3-1'
272+ }
273+ ]
274+
275+ assert expected == next (G )
0 commit comments