MCPcopy Index your code
hub / github.com/OWASP/Python-Honeypot / TestCoreAlert

Class TestCoreAlert

tests/test_core_compatible.py:7–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6
7class TestCoreAlert(unittest.TestCase):
8
9 def test_run_with_verbose_option(self):
10 testargs = ['python3', 'ohp.py', '--verbose']
11 with patch.object(sys, 'argv', testargs):
12 returned_value = is_verbose_mode()
13 self.assertEqual(returned_value, True)
14
15 def test_run_without_verbose_option(self):
16 testargs = ['python3', 'ohp.py']
17 with patch.object(sys, 'argv', testargs):
18 returned_value = is_verbose_mode()
19 self.assertEqual(returned_value, False)
20
21 def test_byte_to_str(self):
22 content = b"hello"
23 self.assertIsInstance(byte_to_str(content), str)
24
25 def test_generate_token(self):
26 self.assertEqual(len(generate_token(16)), 16)
27 self.assertEqual(len(generate_token(32)), 32)
28 self.assertEqual(len(generate_token(48)), 48)
29 self.assertEqual(len(generate_token(1)), 1)
30 self.assertEqual(len(generate_token()), 32) # default

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected