mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-04-25 22:17:49 +02:00
Add automated CI for analyzers
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
[pytest]
|
||||
python_files = *_test.py
|
||||
python_classes = Test
|
||||
python_functions = test_*
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
if __name__ == .__main__.:
|
||||
@@ -1,5 +0,0 @@
|
||||
def main():
|
||||
print '{"foo":"bar","summary":"something here"}'
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,5 +1,5 @@
|
||||
def main():
|
||||
print '{"result":{ "requestId": "something-generated-by-whois", "someother_field": "more data" }, "summary": "botsrv.btc-goblin.ru"}'
|
||||
print('{"result":{ "requestId": "something-generated-by-whois", "someother_field": "more data" }, "summary": "botsrv.btc-goblin.ru"}')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,12 @@
|
||||
from io import StringIO
|
||||
from unittest.mock import patch
|
||||
from whois import whois
|
||||
import unittest
|
||||
|
||||
class TestWhoisMethods(unittest.TestCase):
|
||||
|
||||
def test_main(self):
|
||||
with patch('sys.stdout', new = StringIO()) as mock_stdout:
|
||||
whois.main()
|
||||
expected = '{"result":{ "requestId": "something-generated-by-whois", "someother_field": "more data" }, "summary": "botsrv.btc-goblin.ru"}\n'
|
||||
self.assertEqual(mock_stdout.getvalue(), expected)
|
||||
Reference in New Issue
Block a user