Skip to content

Commit

Permalink
Revert "Fallback to empty list when block type is not present on cach…
Browse files Browse the repository at this point in the history
…e.json" (#22845)
  • Loading branch information
willdurand authored Nov 13, 2024
1 parent c7ef746 commit f26254d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/olympia/blocklist/mlbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ def __init__(self, storage: SafeStorage):

@cached_property
def blocked_items(self) -> List[str]:
return self._data.get(self.data_type_key(MLBFDataType.BLOCKED), [])
return self._data.get(self.data_type_key(MLBFDataType.BLOCKED))

@cached_property
def soft_blocked_items(self) -> List[str]:
return self._data.get(self.data_type_key(MLBFDataType.SOFT_BLOCKED), [])
return self._data.get(self.data_type_key(MLBFDataType.SOFT_BLOCKED))

@cached_property
def not_blocked_items(self) -> List[str]:
return self._data.get(self.data_type_key(MLBFDataType.NOT_BLOCKED), [])
return self._data.get(self.data_type_key(MLBFDataType.NOT_BLOCKED))


class MLBFDataBaseLoader(BaseMLBFLoader):
Expand Down
10 changes: 0 additions & 10 deletions src/olympia/blocklist/tests/test_mlbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@ def test_loads_data_from_file(self):
loader = MLBFStorageLoader(self.storage)
assert loader._raw == self._data

def test_fallback_to_empty_list_for_missing_key(self):
for key in self._data.keys():
new_data = self._data.copy()
new_data.pop(key)
with self.storage.open('cache.json', 'w') as f:
json.dump(new_data, f)
loader = MLBFStorageLoader(self.storage)
assert loader._raw == {**new_data, key: []}



class TestMLBFDataBaseLoader(_MLBFBase):
def test_load_returns_expected_data(self):
Expand Down

0 comments on commit f26254d

Please sign in to comment.