From 7b2ae025c24e7acb9a5f8d17430f79c9a7c58393 Mon Sep 17 00:00:00 2001 From: twangboy Date: Mon, 20 Apr 2020 15:34:39 -0600 Subject: [PATCH] Fix black --- salt/modules/win_task.py | 26 ++++++++++---------- tests/integration/modules/test_win_task.py | 28 ++++++++++++---------- tests/unit/modules/test_win_task.py | 2 +- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/salt/modules/win_task.py b/salt/modules/win_task.py index bdf0978e3448..72f7183fde0e 100644 --- a/salt/modules/win_task.py +++ b/salt/modules/win_task.py @@ -19,8 +19,8 @@ # Import Salt libs import salt.utils.platform import salt.utils.winapi -from salt.ext.six.moves import range from salt.exceptions import ArgumentValueError, CommandExecutionError +from salt.ext.six.moves import range # Import 3rd Party Libraries try: @@ -681,37 +681,37 @@ def create_task_from_xml( except pythoncom.com_error as error: hr, msg, exc, arg = error.args # pylint: disable=W0633 - error_code = hex(exc[5] + 2**32) + error_code = hex(exc[5] + 2 ** 32) fc = { 0x80041319: "Required element or attribute missing", 0x80041318: "Value incorrectly formatted or out of range", 0x80020005: "Access denied", 0x80041309: "A task's trigger is not found", 0x8004130a: "One or more of the properties required to run this " - "task have not been set", + "task have not been set", 0x8004130c: "The Task Scheduler service is not installed on this " - "computer", + "computer", 0x8004130d: "The task object could not be opened", 0x8004130e: "The object is either an invalid task object or is not " - "a task object", + "a task object", 0x8004130f: "No account information could be found in the Task " - "Scheduler security database for the task indicated", + "Scheduler security database for the task indicated", 0x80041310: "Unable to establish existence of the account " - "specified", + "specified", 0x80041311: "Corruption was detected in the Task Scheduler " - "security database; the database has been reset", + "security database; the database has been reset", 0x80041313: "The task object version is either unsupported or " - "invalid", + "invalid", 0x80041314: "The task has been configured with an unsupported " - "combination of account settings and run time options", + "combination of account settings and run time options", 0x80041315: "The Task Scheduler Service is not running", 0x80041316: "The task XML contains an unexpected node", 0x80041317: "The task XML contains an element or attribute from an " - "unexpected namespace", + "unexpected namespace", 0x8004131a: "The task XML is malformed", 0x0004131c: "The task is registered, but may fail to start. Batch " - "logon privilege needs to be enabled for the task " - "principal", + "logon privilege needs to be enabled for the task " + "principal", 0x8004131d: "The task XML contains too many nodes of the same type", } try: diff --git a/tests/integration/modules/test_win_task.py b/tests/integration/modules/test_win_task.py index f9612796f7c2..fca8518792b1 100644 --- a/tests/integration/modules/test_win_task.py +++ b/tests/integration/modules/test_win_task.py @@ -1,25 +1,24 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals -from tests.support.case import ModuleCase -from tests.support.unit import skipIf -from tests.support.helpers import destructiveTest - import salt.modules.win_task as task -from salt.exceptions import CommandExecutionError import salt.utils.platform +from salt.exceptions import CommandExecutionError +from tests.support.case import ModuleCase +from tests.support.helpers import destructiveTest +from tests.support.unit import skipIf -@skipIf(not salt.utils.platform.is_windows(), 'windows test only') +@skipIf(not salt.utils.platform.is_windows(), "windows test only") class WinTasksTest(ModuleCase): """ Tests for salt.modules.win_task. """ @destructiveTest def test_adding_task_with_xml(self): - ''' + """ Test adding a task using xml - ''' + """ xml_text = r""" @@ -66,15 +65,18 @@ def test_adding_task_with_xml(self): """ - self.assertEquals(self.run_function('task.create_task_from_xml', 'foo', xml_text=xml_text), True) - all_tasks = self.run_function('task.list_tasks') - self.assertIn('foo', all_tasks) + self.assertEquals( + self.run_function('task.create_task_from_xml', 'foo', xml_text=xml_text), + True, + ) + all_tasks = self.run_function("task.list_tasks") + self.assertIn("foo", all_tasks) @destructiveTest def test_adding_task_with_invalid_xml(self): - ''' + """ Test adding a task using a malformed xml - ''' + """ xml_text = r"""