def test_hook(self): """ tests for hooks """ Monitor_test_obj = Monitor() result_inactivated = Monitor_test_obj.hook_enabled() assert not result_inactivated # activate the hook Monitor_test_obj.activate_hook() result_activated = Monitor_test_obj.hook_enabled() assert result_activated
def test_trigger_dump(self): """ test for trigger_dump """ Monitor_test_obj = Monitor() # activate the hook first Monitor_test_obj.activate_hook() with open(self.src, "w") as f: result = Monitor_test_obj.trigger_dump(f) # read the content of first line with open(self.src, "r") as f: f.seek(1) assert 'Dumping thread' in f.readline()
def test_trigger_dump(self): """ test for trigger_dump """ Monitor_test_obj = Monitor() # activate the hook first Monitor_test_obj.activate_hook() with open(self.src, "w") as f: result = Monitor_test_obj.trigger_dump(f) # read the content of first line with open(self.src, "r") as f: f.readline() assert 'Dumping thread' in f.readline()