>From 88122162235e5e40afc26161f80544427f6ca50a Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Fri, 23 Oct 2015 08:52:49 +0200 Subject: [PATCH] intg_tests: Fix PEP8 warnings --- src/tests/intg/ent.py | 28 ++++++++++++++-------------- src/tests/intg/ent_test.py | 14 +++++++------- src/tests/intg/ldap_test.py | 6 ++++-- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/tests/intg/ent.py b/src/tests/intg/ent.py index 0fe08dcbd8195af7dcdeedc5b31dbe5d0d85ff08..2d3d02a539945b00d81f158383ba82b3de8155d3 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 abba94a24f81cb3c099eef396eee57bee7ed0c9b..598930324a41ad9ff473e94e7f2deb302e1bc942 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 6a09b372529e82fc326e9667ff9b9e6153ab94ce..6d61726b85a155a994fc6338ea3c806c54963fe1 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: -- 2.5.0