def test_get_primary_account_data(self):
    id1 = Identity.create_random_identity()
    acc1 = Address.create_from_identity(id1, full_shard_key=0)
    acc2 = Address.create_random_account(full_shard_key=1)
    with ClusterContext(1, acc1) as clusters:
        master = clusters[0].master
        slaves = clusters[0].slave_list
        self.assertEqual(call_async(master.get_primary_account_data(acc1)).transaction_count, 0)
        tx = create_transfer_transaction(shard_state=clusters[0].get_shard_state(2), key=id1.get_key(), from_address=acc1, to_address=acc1, value=12345)
        self.assertTrue(slaves[0].add_tx(tx))
        root = call_async(master.get_next_block_to_mine(address=acc1, branch_value=None))
        call_async(master.add_root_block(root))
        block1 = call_async(master.get_next_block_to_mine(address=acc1, branch_value=2))
        self.assertTrue(call_async(master.add_raw_minor_block(block1.header.branch, block1.serialize())))
        self.assertEqual(call_async(master.get_primary_account_data(acc1)).transaction_count, 1)
        self.assertEqual(call_async(master.get_primary_account_data(acc2)).transaction_count, 0)
def test_get_primary_account_data(self):
    id1 = Identity.create_random_identity()
    acc1 = Address.create_from_identity(id1, full_shard_key=0)
    acc2 = Address.create_random_account(full_shard_key=1)
    with ClusterContext(1, acc1) as clusters:
        master = clusters[0].master
        slaves = clusters[0].slave_list
        self.assertEqual(call_async(master.get_primary_account_data(acc1)).transaction_count, 0)
        tx = create_transfer_transaction(shard_state=clusters[0].get_shard_state(2), key=id1.get_key(), from_address=acc1, to_address=acc1, value=12345)
        self.assertTrue(slaves[0].add_tx(tx))
        root = call_async(master.get_next_block_to_mine(address=acc1, branch_value=None))
        call_async(master.add_root_block(root))
        block1 = call_async(master.get_next_block_to_mine(address=acc1, branch_value=2))
        self.assertTrue(call_async(master.add_raw_minor_block(block1.header.branch, block1.serialize())))
        self.assertEqual(call_async(master.get_primary_account_data(acc1)).transaction_count, 1)
        self.assertEqual(call_async(master.get_primary_account_data(acc2)).transaction_count, 0)