Fix mock conflict resolution

This commit is contained in:
s3lph 2022-04-17 01:03:34 +02:00
parent 1c517bd8a7
commit 7e0c4a6100

View file

@ -17,7 +17,8 @@ def _resolve(target: str,
# Mock conflict resolution that does not send or prepare messages
subs: Dict[str, List[SchleuderSubscriber]] = {}
for s in subscriptions:
subs.setdefault(s.email, []).append(s)
if s.key is not None:
subs.setdefault(s.email, []).append(s)
return [min(s, key=lambda x: x.created_at) for s in subs.values()]
@ -116,6 +117,8 @@ def _get_subs(schleuder: SchleuderList):
elif schleuder.id == 6:
return [
SchleuderSubscriber(10, 'aaron.example@example.org', key9, schleuder.id, date2),
# No key, should not be subscribed
SchleuderSubscriber(11, 'arno.example@example.org', None, schleuder.id, date1),
]
else:
return []