Skip to content

Commit

Permalink
Fix unwanted AttributeError in messagetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
g1itch committed Jul 5, 2019
1 parent c9bc97f commit 8b065d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/messagetypes/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def encode(self, data):
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):
Expand Down
8 changes: 8 additions & 0 deletions src/tests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def test_msgcoding(self):
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)}
Expand Down

0 comments on commit 8b065d2

Please sign in to comment.