Analyzer CI

This commit is contained in:
Jason Ertel
2022-03-29 13:40:56 -04:00
parent 0a8d24a225
commit cb491630ae
3 changed files with 11 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
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()
main()

View File

@@ -3,10 +3,11 @@ 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:
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)