mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix E712 comparison to True / False
Related: https://pagure.io/freeipa/issue/8306 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
@@ -131,7 +131,7 @@ class IPAOptionParser(OptionParser):
|
||||
safe_opts_dict = {}
|
||||
|
||||
for option, value in opts.__dict__.items():
|
||||
if all_opts_dict[option].sensitive != True:
|
||||
if not all_opts_dict[option].sensitive:
|
||||
safe_opts_dict[option] = value
|
||||
|
||||
return Values(safe_opts_dict)
|
||||
|
||||
@@ -239,7 +239,7 @@ def _make_aci(ldap, current, aciname, kw):
|
||||
|
||||
group = 'group' in kw
|
||||
permission = 'permission' in kw
|
||||
selfaci = 'selfaci' in kw and kw['selfaci'] == True
|
||||
selfaci = kw.get("selfaci", False)
|
||||
if group + permission + selfaci > 1:
|
||||
raise errors.ValidationError(name='target', error=_('group, permission and self are mutually exclusive'))
|
||||
elif group + permission + selfaci == 0:
|
||||
@@ -945,7 +945,7 @@ class aci_rename(crud.Update):
|
||||
# a series of keywords. Then we replace any keywords that have been
|
||||
# updated and convert that back into an ACI and write it out.
|
||||
newkw = _aci_to_kw(ldap, aci)
|
||||
if 'selfaci' in newkw and newkw['selfaci'] == True:
|
||||
if newkw.get("selfaci"):
|
||||
# selfaci is set in aci_to_kw to True only if the target is self
|
||||
kw['selfaci'] = True
|
||||
if 'aciname' in newkw:
|
||||
|
||||
@@ -789,7 +789,7 @@ ipa idrange-del before retrying the command with the desired range type.
|
||||
if (options.get('trust_type') == u'ad' and
|
||||
options.get('trust_secret') is None):
|
||||
|
||||
if options.get('bidirectional') == True:
|
||||
if options.get('bidirectional'):
|
||||
# Bidirectional trust allows us to use cross-realm TGT,
|
||||
# so we can run the call under original user's credentials
|
||||
res = fetch_domains_from_trust(self.api, self.trustinstance,
|
||||
|
||||
@@ -119,13 +119,10 @@ class test_keyring:
|
||||
See if a key is available
|
||||
"""
|
||||
kernel_keyring.add_key(TEST_KEY, TEST_VALUE)
|
||||
assert kernel_keyring.has_key(TEST_KEY)
|
||||
|
||||
result = kernel_keyring.has_key(TEST_KEY)
|
||||
assert(result == True)
|
||||
kernel_keyring.del_key(TEST_KEY)
|
||||
|
||||
result = kernel_keyring.has_key(TEST_KEY)
|
||||
assert(result == False)
|
||||
assert not kernel_keyring.has_key(TEST_KEY)
|
||||
|
||||
def test_07(self):
|
||||
"""
|
||||
|
||||
@@ -134,8 +134,8 @@ class test_Fuzzy:
|
||||
assert (self.klass(test=t, type=unicode) == b'foobar') is False
|
||||
assert (self.klass(test=t) == 'barfoo') is False
|
||||
|
||||
assert (False == self.klass()) is True
|
||||
assert (True == self.klass()) is True
|
||||
assert (False == self.klass()) is True # noqa
|
||||
assert (True == self.klass()) is True # noqa
|
||||
assert (None == self.klass()) is True # noqa
|
||||
|
||||
|
||||
|
||||
@@ -240,19 +240,19 @@ class test_cert(BaseCert):
|
||||
from ipaserver.plugins.cert import _emails_are_valid
|
||||
email_addrs = [u'any@EmAiL.CoM']
|
||||
result = _emails_are_valid(email_addrs, [u'any@email.com'])
|
||||
assert True == result, result
|
||||
assert result
|
||||
|
||||
email_addrs = [u'any@EmAiL.CoM']
|
||||
result = _emails_are_valid(email_addrs, [u'any@email.com',
|
||||
u'another@email.com'])
|
||||
assert True == result, result
|
||||
assert result
|
||||
|
||||
result = _emails_are_valid([], [u'any@email.com'])
|
||||
assert True == result, result
|
||||
assert result
|
||||
|
||||
email_addrs = [u'invalidEmailAddress']
|
||||
result = _emails_are_valid(email_addrs, [])
|
||||
assert False == result, result
|
||||
assert not result
|
||||
|
||||
def test_99999_cleanup(self):
|
||||
"""
|
||||
|
||||
@@ -115,7 +115,7 @@ class test_hbactest(XMLRPC_test):
|
||||
service=self.test_service,
|
||||
rules=self.rule_names
|
||||
)
|
||||
assert ret['value'] == True
|
||||
assert ret['value']
|
||||
assert ret['error'] is None
|
||||
for i in [0,1,2,3]:
|
||||
assert self.rule_names[i] in ret['matched']
|
||||
@@ -131,7 +131,7 @@ class test_hbactest(XMLRPC_test):
|
||||
rules=self.rule_names,
|
||||
nodetail=True
|
||||
)
|
||||
assert ret['value'] == True
|
||||
assert ret['value']
|
||||
assert ret['error'] is None
|
||||
assert ret['matched'] is None
|
||||
assert ret['notmatched'] is None
|
||||
@@ -180,7 +180,7 @@ class test_hbactest(XMLRPC_test):
|
||||
nodetail=True
|
||||
)
|
||||
|
||||
assert ret['value'] == False
|
||||
assert not ret['value']
|
||||
assert ret['matched'] is None
|
||||
assert ret['notmatched'] is None
|
||||
for rule in self.rule_names:
|
||||
|
||||
Reference in New Issue
Block a user