Fix unwanted AttributeError in messagetypes

This commit is contained in:
Dmitri Bogomolov 2019-07-05 11:45:12 +03:00
parent c9bc97f4b2
commit 8b065d2e57
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 9 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class Message(MsgBase):
self.data["subject"] = data["subject"]
self.data["body"] = data["body"]
except KeyError as e:
logger.error("Missing key %s", e.name)
logger.error("Missing key %s", e)
return self.data
def process(self):

View File

@ -70,6 +70,14 @@ class TestCore(unittest.TestCase):
self.assertEqual(msg_data['subject'], obj3e.subject)
self.assertEqual(msg_data['body'], obj3e.body)
try:
MsgEncode({'body': 'A msg with no subject'}, 3)
except Exception as e:
self.fail(
'Exception %s whyle trying to encode message'
' with no subject!' % e
)
def _wipe_knownnodes(self):
with knownnodes.knownNodesLock:
knownnodes.knownNodes = {stream: {} for stream in range(1, 4)}