mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-12 20:22:59 +01:00
14 lines
473 B
Python
14 lines
473 B
Python
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)
|