Skip to content

Commit 128093e

Browse files
committed
#17 use revamped code
1 parent 3968b05 commit 128093e

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

tests/test_suite_analyzer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_check_tlp_disabled(self):
7575

7676
# Using the _Analyzer__check_tlp notation to access managed method
7777
# __check_tlp
78-
self.assertEqual(self.analyzer._Analyzer__check_tlp(), True)
78+
self.assertEqual(self.analyzer._Worker__check_tlp(), True)
7979

8080
def test_check_tlp_ko(self):
8181
self.analyzer.enable_check_tlp = True
@@ -84,7 +84,7 @@ def test_check_tlp_ko(self):
8484

8585
# Using the _Analyzer__check_tlp notation to access managed method
8686
# __check_tlp
87-
self.assertEqual(self.analyzer._Analyzer__check_tlp(), False)
87+
self.assertEqual(self.analyzer._Worker__check_tlp(), False)
8888

8989
def test_check_tlp_ok(self):
9090
self.analyzer.enable_check_tlp = True
@@ -93,7 +93,7 @@ def test_check_tlp_ok(self):
9393

9494
# Using the _Analyzer__check_tlp notation to access managed method
9595
# __check_tlp
96-
self.assertEqual(self.analyzer._Analyzer__check_tlp(), True)
96+
self.assertEqual(self.analyzer._Worker__check_tlp(), True)
9797

9898

9999
class TestErrorResponse(unittest.TestCase):
@@ -113,7 +113,7 @@ def test_error_response(self):
113113
self.analyzer.error('Error', True)
114114

115115
# Get the output
116-
output = self.analyzer.fpoutput.getvalue().strip()
116+
output = sys.stdout.getvalue().strip()
117117
json_output = json.loads(output)
118118

119119
self.assertEqual(json_output['success'], False)
@@ -137,7 +137,7 @@ def test_report_response(self):
137137
self.analyzer.report({'report_id': '12345'})
138138

139139
# Get the output
140-
output = self.analyzer.fpoutput.getvalue().strip()
140+
output = sys.stdout.getvalue().strip()
141141
json_output = json.loads(output)
142142

143143
self.assertEqual(json_output.get('success'), True)

tests/test_suite_extractor.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,34 @@ def test_iterable(self):
113113
})
114114
l_expected = [
115115
{
116-
'type': 'hash',
117-
'value': '7ef8b3dc5bf40268f66721a89b95f4c5f0cc08e34836f8c3a007ceed193654d4'
116+
'dataType': 'hash',
117+
'data': '7ef8b3dc5bf40268f66721a89b95f4c5f0cc08e34836f8c3a007ceed193654d4'
118118
},
119119
{
120-
'type': 'ip',
121-
'value': '127.0.0.1'
120+
'dataType': 'ip',
121+
'data': '127.0.0.1'
122122
},
123123
{
124-
'type': 'url',
125-
'value': 'https://nestedurl.verynested.com'
124+
'dataType': 'url',
125+
'data': 'https://nestedurl.verynested.com'
126126
},
127127
{
128-
'type': 'domain',
129-
'value': 'google.de'
128+
'dataType': 'domain',
129+
'data': 'google.de'
130130
},
131131
{
132-
'type': 'domain',
133-
'value': 'bing.com'
132+
'dataType': 'domain',
133+
'data': 'bing.com'
134134
},
135135
{
136-
'type': 'fqdn',
137-
'value': 'www.fqdn.de'
136+
'dataType': 'fqdn',
137+
'data': 'www.fqdn.de'
138138
}
139139
]
140140

141141
# Sorting the lists
142-
l_real = sorted(l_real, key=lambda k: k['value'])
143-
l_expected = sorted(l_expected, key=lambda k: k['value'])
142+
l_real = sorted(l_real, key=lambda k: k['data'])
143+
l_expected = sorted(l_expected, key=lambda k: k['data'])
144144

145145
self.assertEqual(
146146
l_real,

tests/test_suite_integration.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ def test_output(self):
2727
self.analyzer.report({'result': '1.2.3.4'})
2828

2929
# Grab the output
30-
output = self.analyzer.fpoutput.getvalue().strip()
30+
output = sys.stdout.getvalue().strip()
3131
json_output = json.loads(output)
3232

3333
# Checks
3434
self.assertNotIn(self.analyzer.get_data(), output)
35-
self.assertEqual(json_output['artifacts'][0]['value'], '1.2.3.4')
36-
self.assertEqual(json_output['artifacts'][0]['type'], 'ip')
35+
self.assertEqual(json_output['artifacts'][0]['data'], '1.2.3.4')
36+
self.assertEqual(json_output['artifacts'][0]['dataType'], 'ip')
3737

3838
class AnalyzerExtractorNoResultTest(unittest.TestCase):
3939
def setUp(self):
@@ -51,8 +51,8 @@ def test_output(self):
5151
})
5252

5353
# Grab the output
54-
output = self.analyzer.fpoutput.getvalue().strip()
54+
output = sys.stdout.getvalue().strip()
5555
json_output = json.loads(output)
5656

5757
# Check for empty artifact list
58-
self.assertEqual(json_output['artifacts'], [], 'Artifact list should be empty.')
58+
self.assertEqual(json_output['artifacts'], [], 'Artifact list should be empty.')

0 commit comments

Comments
 (0)