From 6c1a29c0d63ca630a36eef61a0f38baf9f7a59a8 Mon Sep 17 00:00:00 2001 From: kaliko Date: Thu, 23 Mar 2023 17:30:33 +0100 Subject: [PATCH] rtbl: Ease testing Make testing easier with rtbl.BL.init mapping to add testing item to the block list (locally). Generate a hash: >>> import hashlib >>> test_hash = hashlib.sha256('user@example.org'.encode('utf-8')).hexdigest() Then use it to pre-populate the block list: >>> from sid.rtbl import RTBL, BL >>> BL.init = {test_hash: 'For testing purposes'} --- sid/rtbl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sid/rtbl.py b/sid/rtbl.py index 0ea3bbb..b5c58cb 100644 --- a/sid/rtbl.py +++ b/sid/rtbl.py @@ -21,9 +21,11 @@ def jid_to_sha256(jid: JID) -> str: class BL: """Plain object to keep track of block list items. Only used in RTBL plugin.""" + #: Initial seed to ease testing + init = {} def __init__(self, initial_bl): - self.sha256_jids: Dict[str, Optional[str]] = {} + self.sha256_jids: Dict[str, Optional[str]] = dict(BL.init) for item in initial_bl: self.insert_item(item) -- 2.39.2