From 36f92c5a73d08b75626c688b0600c891a282f0bb Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Oct 26 2015 06:16:21 +0000 Subject: intg_tests: Fix PEP8 warnings Reviewed-by: Michal Židek (cherry picked from commit 46c89176fd7f140d785bbdc399a94daca269172e) --- diff --git a/src/tests/intg/ent.py b/src/tests/intg/ent.py index 0fe08dc..2d3d02a 100644 --- a/src/tests/intg/ent.py +++ b/src/tests/intg/ent.py @@ -129,7 +129,7 @@ def _diff(ent, pattern, desc_map={}): items = _get_desc(desc_map, None)[0] + "s" if len(unmatched_pattern) > 0: return "\nexpected " + items + " not found:\n" + \ - pformat(unmatched_pattern) + pformat(unmatched_pattern) elif isinstance(pattern, list): if not isinstance(ent, list): return "not a list, " + str(type(ent)) @@ -153,10 +153,10 @@ def _diff(ent, pattern, desc_map={}): d = "" if len(unmatched_pattern) > 0: d += "\nexpected " + items + " not found:\n" + \ - pformat(unmatched_pattern) + pformat(unmatched_pattern) if len(unmatched_ent) != 0: d += "\nunexpected " + items + " found:\n" + \ - pformat(unmatched_ent) + pformat(unmatched_ent) if len(d) > 0: return d else: @@ -187,13 +187,13 @@ def _convert_passwd(passwd): Convert a passwd entry returned by pwd module to an entry dictionary. """ return dict( - name=passwd.pw_name, - passwd=passwd.pw_passwd, - uid=passwd.pw_uid, - gid=passwd.pw_gid, - gecos=passwd.pw_gecos, - dir=passwd.pw_dir, - shell=passwd.pw_shell + name=passwd.pw_name, + passwd=passwd.pw_passwd, + uid=passwd.pw_uid, + gid=passwd.pw_gid, + gecos=passwd.pw_gecos, + dir=passwd.pw_dir, + shell=passwd.pw_shell ) @@ -350,10 +350,10 @@ def _convert_group(group): Convert a group entry returned by grp module to an entry dictionary. """ return dict( - name=group.gr_name, - passwd=group.gr_passwd, - gid=group.gr_gid, - mem=group.gr_mem + name=group.gr_name, + passwd=group.gr_passwd, + gid=group.gr_gid, + mem=group.gr_mem ) diff --git a/src/tests/intg/ent_test.py b/src/tests/intg/ent_test.py index abba94a..5989303 100644 --- a/src/tests/intg/ent_test.py +++ b/src/tests/intg/ent_test.py @@ -169,7 +169,7 @@ def test_assert_each_passwd_by_name(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "user 'user1' mismatch: 'name' mismatch: 'user2' != 'user1'" + "user 'user1' mismatch: 'name' mismatch: 'user2' != 'user1'" def test_assert_each_passwd_by_uid(users_and_groups): @@ -186,7 +186,7 @@ def test_assert_each_passwd_by_uid(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "user 1001 mismatch: 'uid' mismatch: 1002 != 1001" + "user 1001 mismatch: 'uid' mismatch: 1002 != 1001" def test_assert_each_passwd_with_name(users_and_groups): @@ -203,7 +203,7 @@ def test_assert_each_passwd_with_name(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "user 'user1' mismatch: 'uid' mismatch: 1002 != 1001" + "user 'user1' mismatch: 'uid' mismatch: 1002 != 1001" def test_assert_each_passwd_with_uid(users_and_groups): @@ -220,7 +220,7 @@ def test_assert_each_passwd_with_uid(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "user 1001 mismatch: 'name' mismatch: 'user2' != 'user1'" + "user 1001 mismatch: 'name' mismatch: 'user2' != 'user1'" def test_assert_passwd(users_and_groups): @@ -381,7 +381,7 @@ def test_assert_each_group_by_gid(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "group 2001 mismatch: 'gid' mismatch: 2002 != 2001" + "group 2001 mismatch: 'gid' mismatch: 2002 != 2001" def test_assert_each_group_with_name(users_and_groups): @@ -398,7 +398,7 @@ def test_assert_each_group_with_name(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "group 'group1' mismatch: 'gid' mismatch: 2002 != 2001" + "group 'group1' mismatch: 'gid' mismatch: 2002 != 2001" def test_assert_each_group_with_gid(users_and_groups): @@ -415,7 +415,7 @@ def test_assert_each_group_with_gid(users_and_groups): assert False except AssertionError as e: assert str(e) == \ - "group 2001 mismatch: 'name' mismatch: 'group2' != 'group1'" + "group 2001 mismatch: 'name' mismatch: 'group2' != 'group1'" def test_assert_group(users_and_groups): diff --git a/src/tests/intg/ldap_test.py b/src/tests/intg/ldap_test.py index 6a09b37..6d61726 100644 --- a/src/tests/intg/ldap_test.py +++ b/src/tests/intg/ldap_test.py @@ -39,8 +39,10 @@ LDAP_BASE_DN = "dc=example,dc=com" def ds_inst(request): """LDAP server instance fixture""" ds_inst = ds_openldap.DSOpenLDAP( - config.PREFIX, 10389, LDAP_BASE_DN, - "cn=admin", "Secret123") + config.PREFIX, 10389, LDAP_BASE_DN, + "cn=admin", "Secret123" + ) + try: ds_inst.setup() except: