Example #1
0
 def test_missing_required_field(self):
     with self.assertRaises(XRPLModelException):
         # missing account
         Transaction(
             fee=_FEE,
             sequence=_SEQUENCE,
             transaction_type=TransactionType.ACCOUNT_DELETE,
         )
Example #2
0
 def test_initializes_if_all_required_fields_present(self):
     tx = Transaction(
         account=_ACCOUNT,
         fee=_FEE,
         sequence=_SEQUENCE,
         transaction_type=TransactionType.ACCOUNT_DELETE,
     )
     self.assertTrue(tx.is_valid())
Example #3
0
 def test_to_dict_includes_type_as_string(self):
     tx = Transaction(
         account=_ACCOUNT,
         fee=_FEE,
         sequence=_SEQUENCE,
         transaction_type=TransactionType.ACCOUNT_DELETE,
     )
     value = tx.to_dict()["transaction_type"]
     self.assertEqual(type(value), str)
Example #4
0
 def test_to_dict_flag_list(self):
     tx = Transaction(
         account=_ACCOUNT,
         fee=_FEE,
         sequence=_SEQUENCE,
         transaction_type=TransactionType.ACCOUNT_DELETE,
         flags=[0b1, 0b10, 0b100],
     )
     expected_flags = 0b111
     value = tx.to_dict()["flags"]
     self.assertEqual(value, expected_flags)