Exemplo n.º 1
0
 def test_sign_message(self):
     """Test for an error for a sign transaction message."""
     tx_msg = SigningMessage(
         performative=SigningMessage.Performative.SIGN_MESSAGE,
         terms=self.terms,
         raw_message=RawMessage(self.ledger_id, "message"),
     )
     assert tx_msg._is_consistent()
     encoded_tx_msg = tx_msg.encode()
     decoded_tx_msg = tx_msg.serializer.decode(encoded_tx_msg)
     assert tx_msg == decoded_tx_msg
Exemplo n.º 2
0
 def test_sign_transaction(self):
     """Test for an error for a sign transaction message."""
     tx_msg = SigningMessage(
         performative=SigningMessage.Performative.SIGN_TRANSACTION,
         terms=self.terms,
         raw_transaction=RawTransaction(self.ledger_id, "transaction"),
     )
     assert tx_msg._is_consistent()
     encoded_tx_msg = tx_msg.encode()
     decoded_tx_msg = tx_msg.serializer.decode(encoded_tx_msg)
     assert tx_msg == decoded_tx_msg
Exemplo n.º 3
0
 def test_signed_message(self):
     """Test for an error for a signed message."""
     tx_msg = SigningMessage(
         performative=SigningMessage.Performative.SIGNED_MESSAGE,
         message_id=2,
         target=1,
         signed_message=SignedMessage(self.ledger_id, "message"),
     )
     assert tx_msg._is_consistent()
     encoded_tx_msg = tx_msg.encode()
     decoded_tx_msg = tx_msg.serializer.decode(encoded_tx_msg)
     assert tx_msg == decoded_tx_msg
Exemplo n.º 4
0
 def test_signed_transaction(self):
     """Test for an error for a signed transaction."""
     tx_msg = SigningMessage(
         performative=SigningMessage.Performative.SIGNED_TRANSACTION,
         message_id=2,
         target=1,
         signed_transaction=SignedTransaction(self.ledger_id, "signature"),
     )
     assert tx_msg._is_consistent()
     encoded_tx_msg = tx_msg.encode()
     decoded_tx_msg = tx_msg.serializer.decode(encoded_tx_msg)
     assert tx_msg == decoded_tx_msg
Exemplo n.º 5
0
 def test_error_message(self):
     """Test for an error for an error message."""
     tx_msg = SigningMessage(
         performative=SigningMessage.Performative.ERROR,
         message_id=2,
         target=1,
         error_code=SigningMessage.ErrorCode.UNSUCCESSFUL_MESSAGE_SIGNING,
     )
     assert tx_msg._is_consistent()
     encoded_tx_msg = tx_msg.encode()
     decoded_tx_msg = tx_msg.serializer.decode(encoded_tx_msg)
     assert tx_msg == decoded_tx_msg
     assert str(tx_msg.performative) == "error"
     assert len(tx_msg.valid_performatives) == 5
Exemplo n.º 6
0
def test_consistency_check_negative():
    """Test the consistency check, negative case."""
    tx_msg = SigningMessage(
        performative=SigningMessage.Performative.SIGN_TRANSACTION, )
    assert not tx_msg._is_consistent()