-
-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathtest_api_data.py
More file actions
49 lines (45 loc) · 1.63 KB
/
Copy pathtest_api_data.py
File metadata and controls
49 lines (45 loc) · 1.63 KB
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
import api_data as api
from mock import Mock
import pytest
from urllib.request import urlopen
test_data = '''
{ "data": [
{
"Modified": "2008-11-15T00:00:00",
"Published": "2007-02-19T21:28:00",
"access": {
"authentication": "NONE",
"complexity": "MEDIUM",
"vector": "NETWORK"
},
"cvss": 4.3,
"cvss-time": "2007-02-20T14:55:00",
"id": "CVE-2007-1004",
"impact": {
"availability": "NONE",
"confidentiality": "NONE",
"integrity": "PARTIAL"
},
"reason": "Link",
"references": [
"http://securityreason.com/securityalert/2264",
"http://www.securityfocus.com/archive/1/archive/1/460369/100/0/threaded",
"http://www.securityfocus.com/archive/1/archive/1/460412/100/0/threaded",
"http://www.securityfocus.com/archive/1/archive/1/460617/100/0/threaded",
"http://www.securityfocus.com/bid/22601",
"http://xforce.iss.net/xforce/xfdb/32580"
],
"summary": "Mozilla Firefox might allow remote",
"vulnerable_configuration": [
"cpe:2.3:a:mozilla:firefox:2.0:rc3"
],
"vulnerable_configuration_cpe_2_2": [
"cpe:/a:mozilla:firefox:2.0:rc3"
]}]}
'''
def test_output_cve_id():
#BUG:
api.urlopen.read = Mock()
api.urlopen.read.return_value = test_data
api.output_cve_id()
assert api.output_cve_id(name="test") == "CVE-2007-1004"