def test_remove_account(self): w = WalletData(default_ontid='hahaha') acct1 = AccountData(address="123") acct2 = AccountData(address="456") w.add_account(acct1) w.add_account(acct2) print(len(w.accounts)) w.remove_account("123") print(len(w.accounts))
class Wallet(object): def __init__(self): self.wallet = WalletData() def add_account(self, b58_address='AatF7ATuecga82vk8wBqjZizCPUce4rpZ5'): acct = AccountData(b58_address) self.wallet.add_account(acct) def remove_account(self, b58_address='AatF7ATuecga82vk8wBqjZizCPUce4rpZ5'): self.wallet.remove_account(b58_address)
def test_remove_account(self): test_id = "test_ont_id" wallet = WalletData(default_id=test_id) size = 10 address_list = list() for i in range(size): address = randint(0, 1000000000) acct = AccountData(b58_address=address) wallet.add_account(acct) address_list.append(address) self.assertEqual(len(wallet.accounts), i + 1) for i in range(size): rand_address = choice(address_list) wallet.remove_account(rand_address) address_list.remove(rand_address) self.assertEqual(len(wallet.accounts), size - i - 1)