Skip to content

Commit

Permalink
Fix pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
ESiebigteroth authored and meaksh committed Sep 6, 2019
1 parent e29c40b commit b6c93d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 2 additions & 0 deletions salt/utils/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@


_INTERFACES = {}


def _get_interfaces():
'''
Provide a dict of the connected interfaces and their ip addresses
Expand Down
13 changes: 4 additions & 9 deletions tests/unit/grains/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,31 +977,27 @@ def test_dns_return(self):
with patch.object(salt.utils.dns, 'parse_resolv', MagicMock(return_value=resolv_mock)):
assert core.dns() == ret


def test_enablefqdnsFalse(self):
'''
tests enable_fqdns_grains is set to False
'''
with patch.dict('salt.grains.core.__opts__', {'enable_fqdns_grains':False}):
with patch.dict('salt.grains.core.__opts__', {'enable_fqdns_grains': False}):
assert core.fqdns() == {"fqdns": []}


def test_enablefqdnsTrue(self):
'''
testing that grains uses network.fqdns module
'''
with patch.dict('salt.grains.core.__salt__', {'network.fqdns': MagicMock(return_value="my.fake.domain")}):
with patch.dict('salt.grains.core.__opts__', {'enable_fqdns_grains':True}):
with patch.dict('salt.grains.core.__opts__', {'enable_fqdns_grains': True}):
assert core.fqdns() == 'my.fake.domain'


def test_enablefqdnsNone(self):
'''
testing default fqdns grains is returned when enable_fqdns_grains is None
'''
with patch.dict('salt.grains.core.__opts__', {'enable_fqdns_grains':None}):
assert core.fqdns() == {"fqdns": []}

with patch.dict('salt.grains.core.__opts__', {'enable_fqdns_grains': None}):
assert core.fqdns() == {"fqdns": []}

def test_enablefqdnswithoutpaching(self):
'''
Expand All @@ -1010,7 +1006,6 @@ def test_enablefqdnswithoutpaching(self):
with patch.dict('salt.grains.core.__salt__', {'network.fqdns': MagicMock(return_value="my.fake.domain")}):
assert core.fqdns() == 'my.fake.domain'


@skipIf(not salt.utils.platform.is_linux(), 'System is not Linux')
@patch.object(salt.utils, 'is_windows', MagicMock(return_value=False))
@patch('salt.utils.network.ip_addrs', MagicMock(return_value=['1.2.3.4', '5.6.7.8']))
Expand Down

0 comments on commit b6c93d2

Please sign in to comment.