MCPcopy Create free account
hub / github.com/OWASP/Python-Honeypot / TestCoreAlert

Class TestCoreAlert

tests/test_core_alert.py:9–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9class TestCoreAlert(unittest.TestCase):
10
11 def test_run_from_api(self):
12 testargs = ['python3', 'ohp.py', '--start-api-server']
13 with patch.object(sys, 'argv', testargs):
14 returned_value = is_not_run_from_api()
15 self.assertEqual(returned_value, False)
16
17 def test_not_run_from_api(self):
18 testargs = ['python3', 'ohp.py']
19 with patch.object(sys, 'argv', testargs):
20 returned_value = is_not_run_from_api()
21 self.assertEqual(returned_value, True)
22
23 @staticmethod
24 def test_info():
25 msg_content = "Hello"
26 print("this test will spit the message_content in logging format")
27 info(msg_content)
28
29 @staticmethod
30 def test_write_content():
31 msg_content = "Hello"
32 print("this test will spit the message_content in simple format")
33 write(msg_content)
34
35 @staticmethod
36 def test_warn():
37 msg_content = "Error"
38 print("this test will spit the message_content in warning format")
39 warn(msg_content)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected