Ejemplo n.º 1
0
    def testEnableDisable(self):
        actionlogger.enable()
        prev_line_count = self.__lineCount()
        self.app.UntitledNotepad.type_keys('Test pywinauto logging', with_spaces=True)
        self.assertEqual(self.__lineCount(), prev_line_count + 1)

        actionlogger.disable()
        self.app.UntitledNotepad.menu_select('Help->About Notepad')
        self.assertEqual(self.__lineCount(), prev_line_count + 1)

        actionlogger.enable()
        self.app.window(title='About Notepad').OK.click()
        self.assertEqual(self.__lineCount(), prev_line_count + 2)
Ejemplo n.º 2
0
    def test_logger_disable_and_reset(self):
        """Test if the logger can be disabled and level reset"""
        reload_module(actionlogger)

        # verify on mock
        self.logger_patcher = mock.patch('pywinauto.actionlogger.ActionLogger', spec=True)
        mockLogger = self.logger_patcher.start()

        actionlogger.disable()
        self.assertTrue(mockLogger.disable.called)

        actionlogger.reset_level()
        self.assertTrue(mockLogger.reset_level.called)
Ejemplo n.º 3
0
 def close():
     actionlogger.disable()