From f23772e01ae8660748ac3587eea636e75cf9a2c8 Mon Sep 17 00:00:00 2001 From: Marcel Gregoriadis Date: Wed, 16 Oct 2024 11:30:20 +0200 Subject: [PATCH 1/3] Fix missing file key in ConfigBuilder --- ipv8/configuration.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ipv8/configuration.py b/ipv8/configuration.py index fb4467b50..50bdc04aa 100644 --- a/ipv8/configuration.py +++ b/ipv8/configuration.py @@ -396,8 +396,7 @@ def add_key_from_bin(self, alias: str, key_bin_b64: str, file_path: str | None = 'alias': alias, 'bin': key_bin_b64 } - if file_path is not None: - key_config['file'] = file_path + key_config['file'] = file_path self.config['keys'].append(key_config) return self From a2ac4ab7c44a42f4f39af8ac0e04a45084e0309c Mon Sep 17 00:00:00 2001 From: Marcel Gregoriadis Date: Wed, 16 Oct 2024 13:41:11 +0200 Subject: [PATCH 2/3] fixed unit test --- ipv8/test/test_configuration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipv8/test/test_configuration.py b/ipv8/test/test_configuration.py index 7dc0543d4..5b985f1a4 100644 --- a/ipv8/test/test_configuration.py +++ b/ipv8/test/test_configuration.py @@ -188,7 +188,8 @@ def test_add_key_from_bin(self) -> None: expected = { 'alias': "my new key", - 'bin': key_material + 'bin': key_material, + 'file': None } keys = builder.finalize()['keys'] From adf622e1c94283a466210b7af0b956b4ead67f66 Mon Sep 17 00:00:00 2001 From: Marcel Gregoriadis Date: Wed, 16 Oct 2024 13:56:07 +0200 Subject: [PATCH 3/3] fix unittest --- ipv8/configuration.py | 2 +- ipv8/test/test_configuration.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ipv8/configuration.py b/ipv8/configuration.py index 50bdc04aa..5afbe8a32 100644 --- a/ipv8/configuration.py +++ b/ipv8/configuration.py @@ -396,7 +396,7 @@ def add_key_from_bin(self, alias: str, key_bin_b64: str, file_path: str | None = 'alias': alias, 'bin': key_bin_b64 } - key_config['file'] = file_path + key_config['file'] = file_path or "" self.config['keys'].append(key_config) return self diff --git a/ipv8/test/test_configuration.py b/ipv8/test/test_configuration.py index 5b985f1a4..6ee46203d 100644 --- a/ipv8/test/test_configuration.py +++ b/ipv8/test/test_configuration.py @@ -189,7 +189,7 @@ def test_add_key_from_bin(self) -> None: expected = { 'alias': "my new key", 'bin': key_material, - 'file': None + 'file': "" } keys = builder.finalize()['keys']