Fix patch

This commit is contained in:
Wes
2023-12-15 14:26:33 +00:00
parent cd3a661dd6
commit f05eb742dd

View File

@@ -15,7 +15,7 @@ class TestMalwarebazaarMethods(unittest.TestCase):
def test_main_success(self): def test_main_success(self):
with patch('sys.stdout', new=StringIO()) as mock_cmd: with patch('sys.stdout', new=StringIO()) as mock_cmd:
with patch('malwarebazaar.analyze', new=MagicMock(return_value={'test': 'val'})) as mock: with patch('malwarebazaar.malwarebazaar.analyze', new=MagicMock(return_value={'test': 'val'})) as mock:
sys.argv = ["cmd", "input"] sys.argv = ["cmd", "input"]
malwarebazaar.main() malwarebazaar.main()
expected = '{"test": "val"}\n' expected = '{"test": "val"}\n'
@@ -32,8 +32,8 @@ class TestMalwarebazaarMethods(unittest.TestCase):
prepareResultOutput = {'response': '', prepareResultOutput = {'response': '',
'summary': 'no result', 'status': 'info'} 'summary': 'no result', 'status': 'info'}
with patch('malwarebazaar.sendReq', new=MagicMock(return_value=sendReqOutput)) as mock: with patch('malwarebazaar.malwarebazaar.sendReq', new=MagicMock(return_value=sendReqOutput)) as mock:
with patch('malwarebazaar.prepareResults', new=MagicMock(return_value=prepareResultOutput)) as mock2: with patch('malwarebazaar.malwarebazaar.prepareResults', new=MagicMock(return_value=prepareResultOutput)) as mock2:
results = malwarebazaar.analyze(input) results = malwarebazaar.analyze(input)
results2 = malwarebazaar.analyze(input2) results2 = malwarebazaar.analyze(input2)
results3 = malwarebazaar.analyze(input3) results3 = malwarebazaar.analyze(input3)