test/: PEP8 compliancy (#24803)

* test/: PEP8 compliancy

- Make PEP8 compliant

* Python3 chokes on casting int to bytes (#24952)

But if we tell the formatter that the var is a number, it works
This commit is contained in:
Dag Wieers
2017-05-30 19:05:19 +02:00
committed by John R Barker
parent 31c59ad5f9
commit 4efec414e7
110 changed files with 1702 additions and 1547 deletions

View File

@@ -35,6 +35,7 @@ def set_module_args(args):
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def load_fixture(name):
path = os.path.join(fixture_path, name)
@@ -56,13 +57,14 @@ def load_fixture(name):
class AnsibleExitJson(Exception):
pass
class AnsibleFailJson(Exception):
pass
class TestNxosModule(unittest.TestCase):
def execute_module(self, failed=False, changed=False, commands=None,
sort=True, defaults=False):
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
self.load_fixtures(commands)
@@ -110,4 +112,3 @@ class TestNxosModule(unittest.TestCase):
def load_fixtures(self, commands=None):
pass

View File

@@ -25,6 +25,7 @@ from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_command
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosCommandModule(TestNxosModule):
module = nxos_command

View File

@@ -73,7 +73,7 @@ class TestNxosConfigModule(TestNxosModule):
def test_nxos_config_before(self):
args = dict(lines=['hostname switch01', 'ip domain-name eng.ansible.com'],
before=['before command'])
before=['before command'])
set_module_args(args)
@@ -85,7 +85,7 @@ class TestNxosConfigModule(TestNxosModule):
def test_nxos_config_after(self):
args = dict(lines=['hostname switch01', 'ip domain-name eng.ansible.com'],
after=['after command'])
after=['after command'])
set_module_args(args)
@@ -134,6 +134,3 @@ class TestNxosConfigModule(TestNxosModule):
set_module_args(args)
result = self.execute_module()
self.assertIn('__backup__', result)

View File

@@ -61,4 +61,3 @@ class TestNxosEvpnGlobalModule(TestNxosModule):
set_module_args(dict(nv_overlay_evpn=False))
commands = ['no nv overlay evpn']
self.start_configured(changed=True, commands=commands)

View File

@@ -126,5 +126,3 @@ class TestNxosSystemModule(TestNxosModule):
'vrf context management', 'no ip name-server 172.26.1.1', 'exit',
'no system jumbomtu']
self.execute_module(changed=True, commands=commands)