def test_get_storage(self): client = RPCClient() contract_hash = 'd7678dd97c000be3f33e9362e673101bac4ca654' key = 'totalSupply' storage = client.get_storage(contract_hash, key) self.assertIsInstance(storage, bytearray) intval = int.from_bytes(storage, 'little') self.assertEqual(intval, 227000000000000) # now also test for failure key = 'invalidkey' with self.assertRaises(NEORPCException) as context: storage = client.get_storage(contract_hash, key) self.assertTrue("could not decode result" in str(context.exception))
def test_get_storage(self): client = RPCClient() contract_hash = 'd7678dd97c000be3f33e9362e673101bac4ca654' key = 'totalSupply' storage = client.get_storage(contract_hash, key) self.assertIsInstance(storage, bytearray) intval = int.from_bytes(storage, 'little') self.assertEqual(intval, 196900000000000)