Example #1
0
    def test_not_equal(self):
        a1 = Account('a1')
        a1.generateKeys()
        a2 = Account('a1')
        a2.generateKeys()

        self.assertFalse(a1.equals(a2),"Accounts should be different!")
Example #2
0
    def test_marshalling(self):
        # Create an account and convert it to bytes
        in_name = 'Love that hard c**k!'
        account = Account('Visual')
        account.generateKeys()
        logging.debug('Before marshal %s', account)
        buffer = account.toBytes()
#        print('test_marshalling:',buffer.hex())
        logging.debug('Marshalled buffer: %s', buffer.hex())
        # Create a new account from the bytes
        new_account = Account('')
        new_account.fromBytes(buffer)
        logging.debug('Unmarshalled %s', account)
        # Check if they have the content
        self.assertTrue(new_account.equals(account))

        # Different names should be okay, if all else is the same
        new_name = 'resurected!'
        new_account.setName(new_name)
        self.assertEqual(new_name, new_account.getName(),'Account name not set correctly!')
        self.assertTrue(new_account.equals(account), "Names should not affect Account equality!")