Skip to content

Commit

Permalink
add missing test skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Nov 20, 2024
1 parent ea50682 commit 7cb4eb5
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion src/olympia/blocklist/tests/test_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

@freeze_time('2020-01-01 12:34:56')
@override_switch('blocklist_mlbf_submit', active=True)
@override_switch('enable-soft-blocking', active=False)
class TestUploadToRemoteSettings(TestCase):
def setUp(self):
self.user = user_factory()
Expand Down Expand Up @@ -394,7 +395,13 @@ def test_creates_base_filter_if_last_generation_time_invalid(self):
"""
self.mocks['olympia.blocklist.cron.get_last_generation_time'].return_value = 1
upload_mlbf_to_remote_settings(force_base=True)
assert self.mocks['olympia.blocklist.cron.upload_filter.delay'].called
assert (
mock.call(
self.current_time,
filter_list=[],
upload_stash=True,
)
) in self.mocks['olympia.blocklist.cron.upload_filter.delay'].call_args_list

def test_dont_skip_update_if_all_blocked_or_not_blocked(self):
"""
Expand Down Expand Up @@ -462,6 +469,57 @@ def test_pass_correct_arguments_to_upload_filter(self):
upload_stash=False,
)

def test_filter_updated_for_soft_blocked_when_switch_active(self):
"""
Test that the filter is updated for SOFT_BLOCKED block type when there are
sufficient changes and the 'enable-soft-blocking' switch is active.
"""
pass

def test_stash_uploaded_for_soft_blocked_changes_when_below_threshold(self):
"""
Test that a stash is uploaded when there are changes in SOFT_BLOCKED items
below the threshold and the 'enable-soft-blocking' switch is active.
"""
pass

def test_filters_updated_for_all_block_types(self):
"""
Test that filters are updated for both BLOCKED and SOFT_BLOCKED block types
when there are sufficient changes exceeding the threshold for both, and the
'enable-soft-blocking' switch is active.
"""
pass

def test_stash_uploaded_when_previous_filter_is_none(self):
"""
Test that a stash is generated and uploaded when there is no previous filter
and there are changes in blocks.
"""
pass

def test_no_update_when_no_changes_in_blocks(self):
"""
Test that no update occurs and mlbf.delete() is called when there are
no changes in blocks for any block type.
"""
pass

def test_filter_updated_for_blocked_when_soft_blocking_disabled(self):
"""
Test that the filter is updated for BLOCKED block type when there are
sufficient changes, even if the 'enable-soft-blocking' switch is inactive.
"""
pass

def test_upload_filter_delay_called_with_correct_arguments(self):
"""
Test that upload_filter.delay is called with the correct filter_list and
upload_stash arguments when both base_filters_to_update and update_stash
are involved.
"""
pass


class TestTimeMethods(TestCase):
@freeze_time('2024-10-10 12:34:56')
Expand Down

0 comments on commit 7cb4eb5

Please sign in to comment.