Skip to content

test_remotenodeprocessor.py was constructing a Message incorrectly #66

@Poikilos

Description

@Poikilos

This test in test_remotenodeprocessor.py was formerly:

    def testNewNodeSeen(self) :
        self.node21.state = Node.State.Initialized
        msg = Message(MTI.New_Node_Seen, NodeID(21), [])
        self.processor.process(msg, self.node21)

and I changed [] to bytearray()
but adding type checking to the constructor showed that the
test was wrong. What should it actually be?
The 3rd argument should be a destination node, and the last (optional) argument should be data.
For now I changed it to:

    def testNewNodeSeen(self) :
        self.node21.state = Node.State.Initialized
        msg = Message(MTI.New_Node_Seen, NodeID(21), NodeID(0), data=bytearray())
        self.processor.process(msg, self.node21)

The test passes now, but please let me know if any further changes are necessary.

It passed before because:

  • The argument wasn't checked for validity in the Message constructor.
  • The destination is never used in the test (Is that ok in this case?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions