def test_message_with_wrong_key_is_rejected(self): sender = Sender(self.sendr_prv, "Hello World") receiver = Receiver(self.wrong_pub, sender.pack()) try: receiver.unpack() except Receiver.UnauthorizedMessage: pass else: self.fail()
def test_packed_communication_is_json_serializable(self): sender = Sender(self.sendr_prv, "Hello World") import json json.dumps(sender.pack())
def test_communication_packed_by_sender_is_received_by_receiver(self): sender = Sender(self.sendr_prv, "Hello World") receiver = Receiver(self.sendr_pub, sender.pack()) self.assertEquals(receiver.unpack(), "Hello World")