"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/unit/states/test_proxy.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

test_proxy.py  (salt-2019.2.0):test_proxy.py  (salt-2019.2.1)
skipping to change at line 17 skipping to change at line 17
from tests.support.mixins import LoaderModuleMockMixin from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import skipIf, TestCase from tests.support.unit import skipIf, TestCase
from tests.support.mock import ( from tests.support.mock import (
NO_MOCK, NO_MOCK,
NO_MOCK_REASON, NO_MOCK_REASON,
MagicMock, MagicMock,
patch, patch,
call call
) )
# Import 3rd-party libs
from salt.ext import six
# Import Salt Libs # Import Salt Libs
import salt.states.proxy as proxy import salt.states.proxy as proxy
@skipIf(NO_MOCK, NO_MOCK_REASON) @skipIf(NO_MOCK, NO_MOCK_REASON)
class ProxyTestCase(TestCase, LoaderModuleMockMixin): class ProxyTestCase(TestCase, LoaderModuleMockMixin):
''' '''
Validate the proxy state Validate the proxy state
''' '''
def setup_loader_modules(self): def setup_loader_modules(self):
return {proxy: {}} return {proxy: {}}
skipping to change at line 72 skipping to change at line 69
'proxy.get_proxy_bypass': MagicMock(return_value=[]), 'proxy.get_proxy_bypass': MagicMock(return_value=[]),
'proxy.set_http_proxy': set_proxy_mock, 'proxy.set_http_proxy': set_proxy_mock,
'proxy.set_https_proxy': set_proxy_mock, 'proxy.set_https_proxy': set_proxy_mock,
'proxy.set_ftp_proxy': set_proxy_mock, 'proxy.set_ftp_proxy': set_proxy_mock,
'proxy.set_proxy_bypass': set_proxy_mock, 'proxy.set_proxy_bypass': set_proxy_mock,
} }
with patch.dict(proxy.__salt__, patches): with patch.dict(proxy.__salt__, patches):
out = proxy.managed('192.168.0.1', '3128', user='frank', passwor d='passw0rd', out = proxy.managed('192.168.0.1', '3128', user='frank', passwor d='passw0rd',
bypass_domains=['salt.com', 'test.com']) bypass_domains=['salt.com', 'test.com'])
if six.PY3: out['changes']['new'][-1]['bypass_domains'] = sorted(out['change
# Sorting is different in Py3 s']['new'][-1]['bypass_domains'])
out['changes']['new'][-1]['bypass_domains'] = sorted(out['ch
anges']['new'][-1]['bypass_domains'])
calls = [ calls = [
call('192.168.0.1', '3128', 'frank', 'passw0rd', 'Ethernet') , call('192.168.0.1', '3128', 'frank', 'passw0rd', 'Ethernet') ,
call('192.168.0.1', '3128', 'frank', 'passw0rd', 'Ethernet') , call('192.168.0.1', '3128', 'frank', 'passw0rd', 'Ethernet') ,
call('192.168.0.1', '3128', 'frank', 'passw0rd', 'Ethernet') , call('192.168.0.1', '3128', 'frank', 'passw0rd', 'Ethernet') ,
call(['salt.com', 'test.com'], 'Ethernet') call(['salt.com', 'test.com'], 'Ethernet')
] ]
set_proxy_mock.assert_has_calls(calls) set_proxy_mock.assert_has_calls(calls)
self.assertEqual(out, expected) self.assertEqual(out, expected)
 End of changes. 2 change blocks. 
7 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)