Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: William Durand <will+git@drnd.me>
  • Loading branch information
KevinMind and willdurand authored Nov 12, 2024
1 parent 8ec2b4e commit 328fd09
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/olympia/blocklist/tests/test_mlbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,27 +532,30 @@ def test_diff_all_possible_changes(self):
)
# The second version is hard blocked.
block_factory(guid=two.guid, updated_by=self.user, block_type=BlockType.BLOCKED)
# 3. Soft blocked -> (Blocked)
# 3 was soft-blocked and is now hard blocked.
three_block.blockversion_set.first().update(block_type=BlockType.BLOCKED)
# 4. Soft blocked -> (Not blocked)
# 4 was soft blocked and is now unblocked.
four_block.delete()
# 5. Blocked -> (Soft blocked)
# 5 was hard blocked and is now soft blocked.
five_block.blockversion_set.first().update(block_type=BlockType.SOFT_BLOCKED)
# 6. Blocked -> (Not blocked)
# 6 was hard blocked and is now unblocked.
six_block.delete()


# We regenerate another MLBF based on the updates we've just done to verify the final
# state of each version.
second_mlbf = MLBF.generate_from_db('second')

# The order is based on the ID (i.e. creation time) of the block,
# not the version so we expect two after three
# since two was blocked after three
# not the version so we expect two after three since two was
# blocked after three.
assert second_mlbf.generate_diffs(previous_mlbf=first_mlbf) == {
BlockType.BLOCKED: (
[three_hash, two_hash],
[five_hash, six_hash],
4,
),
# Same as above, one had a block created after five so it comes second
# Same as above, one had a block created after five so it comes second.
BlockType.SOFT_BLOCKED: (
[five_hash, one_hash],
[three_hash, four_hash],
Expand Down

0 comments on commit 328fd09

Please sign in to comment.