mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add space before "assert" keyword
This commit is contained in:
parent
6bcb89a8f6
commit
c0eab8b549
1 changed files with 38 additions and 38 deletions
|
@ -56,12 +56,12 @@ class ZypperTestCase(TestCase):
|
|||
}
|
||||
with patch.dict(zypper.__salt__, {'cmd.run_all': MagicMock(return_value=ref_out)}):
|
||||
upgrades = zypper.list_upgrades(refresh=False)
|
||||
assert(len(upgrades) == 3)
|
||||
assert (len(upgrades) == 3)
|
||||
for pkg, version in {'SUSEConnect': '0.2.33-7.1',
|
||||
'bind-utils': '9.9.6P1-35.1',
|
||||
'bind-libs': '9.9.6P1-35.1'}.items():
|
||||
assert(pkg in upgrades)
|
||||
assert(upgrades[pkg] == version)
|
||||
assert (pkg in upgrades)
|
||||
assert (upgrades[pkg] == version)
|
||||
|
||||
|
||||
def test_list_upgrades_error_handling(self):
|
||||
|
@ -98,20 +98,20 @@ class ZypperTestCase(TestCase):
|
|||
ref_out = get_test_data('zypper-products.xml')
|
||||
with patch.dict(zypper.__salt__, {'cmd.run': MagicMock(return_value=ref_out)}):
|
||||
products = zypper.list_products()
|
||||
assert(len(products) == 5)
|
||||
assert(['SLES', 'SLES', 'SUSE-Manager-Proxy', 'SUSE-Manager-Server', 'sle-manager-tools-beta'] ==
|
||||
sorted([prod['name'] for prod in products]))
|
||||
assert('SUSE LLC <https://www.suse.com/>' in [product['vendor'] for product in products])
|
||||
assert([False, False, False, False, True] ==
|
||||
sorted([product['isbase'] for product in products]))
|
||||
assert([False, False, False, False, True] ==
|
||||
sorted([product['installed'] for product in products]))
|
||||
assert(['0', '0', '0', '0', '0'] ==
|
||||
sorted([product['release'] for product in products]))
|
||||
assert([False, False, False, False, u'sles'] ==
|
||||
sorted([product['productline'] for product in products]))
|
||||
assert([1509408000, 1522454400, 1522454400, 1730332800, 1730332800] ==
|
||||
sorted([product['eol_t'] for product in products]))
|
||||
assert (len(products) == 5)
|
||||
assert (['SLES', 'SLES', 'SUSE-Manager-Proxy', 'SUSE-Manager-Server', 'sle-manager-tools-beta'] ==
|
||||
sorted([prod['name'] for prod in products]))
|
||||
assert ('SUSE LLC <https://www.suse.com/>' in [product['vendor'] for product in products])
|
||||
assert ([False, False, False, False, True] ==
|
||||
sorted([product['isbase'] for product in products]))
|
||||
assert ([False, False, False, False, True] ==
|
||||
sorted([product['installed'] for product in products]))
|
||||
assert (['0', '0', '0', '0', '0'] ==
|
||||
sorted([product['release'] for product in products]))
|
||||
assert ([False, False, False, False, u'sles'] ==
|
||||
sorted([product['productline'] for product in products]))
|
||||
assert ([1509408000, 1522454400, 1522454400, 1730332800, 1730332800] ==
|
||||
sorted([product['eol_t'] for product in products]))
|
||||
|
||||
|
||||
def test_refresh_db(self):
|
||||
|
@ -171,17 +171,17 @@ class ZypperTestCase(TestCase):
|
|||
with patch.dict(zypper.__salt__, {'lowpkg.info': MagicMock(return_value=run_out)}):
|
||||
installed = zypper.info_installed()
|
||||
# Test overall products length
|
||||
assert(len(installed) == 2)
|
||||
assert (len(installed) == 2)
|
||||
|
||||
# Test translated fields
|
||||
for pkg_name, pkg_info in installed.items():
|
||||
assert(installed[pkg_name].get('source') == run_out[pkg_name]['source_rpm'])
|
||||
assert (installed[pkg_name].get('source') == run_out[pkg_name]['source_rpm'])
|
||||
|
||||
# Test keys transition from the lowpkg.info
|
||||
for pn_key, pn_val in run_out['virgo-dummy'].items():
|
||||
if pn_key == 'source_rpm':
|
||||
continue
|
||||
assert(installed['virgo-dummy'][pn_key] == pn_val)
|
||||
assert (installed['virgo-dummy'][pn_key] == pn_val)
|
||||
|
||||
def test_info_available(self):
|
||||
'''
|
||||
|
@ -195,19 +195,19 @@ class ZypperTestCase(TestCase):
|
|||
available = zypper.info_available(*test_pkgs, refresh=False)
|
||||
assert (len(available) == 3)
|
||||
for pkg_name, pkg_info in available.items():
|
||||
assert(pkg_name in test_pkgs)
|
||||
assert (pkg_name in test_pkgs)
|
||||
|
||||
assert(available['emacs']['status'] == 'up-to-date')
|
||||
assert(available['emacs']['installed'] == True)
|
||||
assert(available['emacs']['support level'] == 'Level 3')
|
||||
assert(available['emacs']['vendor'] == 'SUSE LLC <https://www.suse.com/>')
|
||||
assert(available['emacs']['summary'] == 'GNU Emacs Base Package')
|
||||
assert (available['emacs']['status'] == 'up-to-date')
|
||||
assert (available['emacs']['installed'] == True)
|
||||
assert (available['emacs']['support level'] == 'Level 3')
|
||||
assert (available['emacs']['vendor'] == 'SUSE LLC <https://www.suse.com/>')
|
||||
assert (available['emacs']['summary'] == 'GNU Emacs Base Package')
|
||||
|
||||
assert(available['vim']['status'] == 'not installed')
|
||||
assert(available['vim']['installed'] == False)
|
||||
assert(available['vim']['support level'] == 'Level 3')
|
||||
assert(available['vim']['vendor'] == 'SUSE LLC <https://www.suse.com/>')
|
||||
assert(available['vim']['summary'] == 'Vi IMproved')
|
||||
assert (available['vim']['status'] == 'not installed')
|
||||
assert (available['vim']['installed'] == False)
|
||||
assert (available['vim']['support level'] == 'Level 3')
|
||||
assert (available['vim']['vendor'] == 'SUSE LLC <https://www.suse.com/>')
|
||||
assert (available['vim']['summary'] == 'Vi IMproved')
|
||||
|
||||
@patch('salt.modules.zypper.refresh_db', MagicMock(return_value=True))
|
||||
def test_latest_version(self):
|
||||
|
@ -218,7 +218,7 @@ class ZypperTestCase(TestCase):
|
|||
'''
|
||||
ref_out = get_test_data('zypper-available.txt')
|
||||
with patch.dict(zypper.__salt__, {'cmd.run_stdout': MagicMock(return_value=ref_out)}):
|
||||
assert(zypper.latest_version('vim') == '7.4.326-2.62')
|
||||
assert (zypper.latest_version('vim') == '7.4.326-2.62')
|
||||
|
||||
@patch('salt.modules.zypper.refresh_db', MagicMock(return_value=True))
|
||||
def test_upgrade_available(self):
|
||||
|
@ -230,8 +230,8 @@ class ZypperTestCase(TestCase):
|
|||
ref_out = get_test_data('zypper-available.txt')
|
||||
with patch.dict(zypper.__salt__, {'cmd.run_stdout': MagicMock(return_value=ref_out)}):
|
||||
for pkg_name in ['emacs', 'python']:
|
||||
assert(not zypper.upgrade_available(pkg_name))
|
||||
assert(zypper.upgrade_available('vim'))
|
||||
assert (not zypper.upgrade_available(pkg_name))
|
||||
assert (zypper.upgrade_available('vim'))
|
||||
|
||||
@patch('salt.modules.zypper.HAS_RPM', True)
|
||||
def test_version_cmp_rpm(self):
|
||||
|
@ -242,7 +242,7 @@ class ZypperTestCase(TestCase):
|
|||
'''
|
||||
with patch('salt.modules.zypper.rpm', MagicMock(return_value=MagicMock)):
|
||||
with patch('salt.modules.zypper.rpm.labelCompare', MagicMock(return_value=0)):
|
||||
assert(0 == zypper.version_cmp('1', '2')) # mock returns 0, which means RPM was called
|
||||
assert (0 == zypper.version_cmp('1', '2')) # mock returns 0, which means RPM was called
|
||||
|
||||
@patch('salt.modules.zypper.HAS_RPM', False)
|
||||
def test_version_cmp_fallback(self):
|
||||
|
@ -253,7 +253,7 @@ class ZypperTestCase(TestCase):
|
|||
'''
|
||||
with patch('salt.modules.zypper.rpm', MagicMock(return_value=MagicMock)):
|
||||
with patch('salt.modules.zypper.rpm.labelCompare', MagicMock(return_value=0)):
|
||||
assert(-1 == zypper.version_cmp('1', '2')) # mock returns -1, a python implementation was called
|
||||
assert (-1 == zypper.version_cmp('1', '2')) # mock returns -1, a python implementation was called
|
||||
|
||||
|
||||
def test_list_pkgs(self):
|
||||
|
@ -285,8 +285,8 @@ class ZypperTestCase(TestCase):
|
|||
'susemanager-build-keys-web': '12.0-5.1.develHead',
|
||||
'apache-commons-cli': '1.2-1.233',
|
||||
'jose4j': '0.4.4-2.1.develHead'}.items():
|
||||
assert(pkgs.get(pkg_name))
|
||||
assert(pkgs[pkg_name] == pkg_version)
|
||||
assert (pkgs.get(pkg_name))
|
||||
assert (pkgs[pkg_name] == pkg_version)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Reference in a new issue