From e33692f40a38a13f4f76edfc8e72d73e297b174a Mon Sep 17 00:00:00 2001 From: s3lph <1375407-s3lph@users.noreply.gitlab.com> Date: Mon, 18 Apr 2022 19:57:36 +0200 Subject: [PATCH] Fix full system test --- multischleuder/processor.py | 11 ++++++----- multischleuder/reporting.py | 6 ++---- test/prepare-schleuder.sh | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/multischleuder/processor.py b/multischleuder/processor.py index a244e7e..3d76d7f 100644 --- a/multischleuder/processor.py +++ b/multischleuder/processor.py @@ -79,11 +79,12 @@ class MultiList: if len(to_add) + len(to_subscribe) + len(to_unsubscribe) + len(to_remove) == 0: self._logger.info(f'No changes for {self._target}') - for admin in target_admins: - report = AdminReport(self._target, admin.email, self._mail_from, - admin.key.blob if admin.key is not None else None, - to_subscribe, to_unsubscribe, to_update, to_add, to_remove) - self._reporter.add_message(report) + else: + for admin in target_admins: + report = AdminReport(self._target, admin.email, self._mail_from, + admin.key.blob if admin.key is not None else None, + to_subscribe, to_unsubscribe, to_update, to_add, to_remove) + self._reporter.add_message(report) self._logger.info(f'Finished processing: {self._target}') def _lists_by_name(self) -> Tuple[SchleuderList, List[SchleuderList]]: diff --git a/multischleuder/reporting.py b/multischleuder/reporting.py index 5705712..fbbcbc5 100644 --- a/multischleuder/reporting.py +++ b/multischleuder/reporting.py @@ -38,8 +38,7 @@ class Message(abc.ABC): return self._mime def _make_mime(self, content: str) -> email.mime.base.MIMEBase: - # Encrypt to all keys, if possible. Fall back to unencrypted otherwise - PGPy does not - # support every possible key algorithm yet, esp. it can't encrypt to ed25519 keys. + # Encrypt to all keys, if possible. Fall back to unencrypted otherwise try: self._mime = self._encrypt_message(content) except Exception: @@ -134,8 +133,7 @@ class AdminReport(Message): removed: Set[SchleuderKey]): if len(subscribed) == 0 and len(unsubscribed) == 0 and \ len(removed) == 0 and len(added) == 0 and len(updated) == 0: - # No changes, not creating admin report - return None + raise ValueError('No changes, not creating admin report') content = f''' == Admin Report for MultiSchleuder {schleuder} == ''' diff --git a/test/prepare-schleuder.sh b/test/prepare-schleuder.sh index 7fbf162..3de2e58 100755 --- a/test/prepare-schleuder.sh +++ b/test/prepare-schleuder.sh @@ -11,7 +11,7 @@ function gen_key { Key-Type: EDDSA Key-Curve: ed25519 Subkey-Type: ECDH -Subkey-Curve: ed25519 +Subkey-Curve: cv25519 Expire-Date: 0 Name-Real: Mutlischleuder Test User Name-Comment: TEST KEY DO NOT USE