Remove implied setting of reject_media/reports

if severity is set to 'suspend'.
Complicates understanding of what the code actually does.
This commit is contained in:
Justin Warren 2023-01-15 10:02:12 +11:00
parent 04c19c62df
commit 3aa2e378e3
No known key found for this signature in database
2 changed files with 0 additions and 17 deletions

View File

@ -127,8 +127,6 @@ class DomainBlock(object):
"""Initialize the DomainBlock """Initialize the DomainBlock
""" """
self.domain = domain self.domain = domain
# Set severity first so if reject_media or reject_reports = False
# that overrides the default of True for severity = 'suspend'
self.severity = severity self.severity = severity
self.public_comment = public_comment self.public_comment = public_comment
self.private_comment = private_comment self.private_comment = private_comment
@ -148,12 +146,6 @@ class DomainBlock(object):
else: else:
self._severity = BlockSeverity(sev) self._severity = BlockSeverity(sev)
# Suspend implies reject_media,reject_reports == True
log.debug('Suspend blocks media and reports')
if self._severity.level == SeverityLevel.SUSPEND:
self.reject_media = True
self.reject_reports = True
def _asdict(self): def _asdict(self):
"""Return a dict version of this object """Return a dict version of this object
""" """

View File

@ -72,12 +72,3 @@ def test_compare_diff_sevs_2():
b = DomainBlock('example1.org', 'noop') b = DomainBlock('example1.org', 'noop')
assert a != b assert a != b
def test_suspend_rejects():
"""A suspend should reject_media and reject_reports
"""
a = DomainBlock('example.org', 'suspend')
assert a.severity.level == SeverityLevel.SUSPEND
assert a.reject_media == True
assert a.reject_reports == True