def test_remove_identity(self): w = WalletData(default_ontid='hahaha') iden = Identity(ontid="123") w.add_identity(iden) print(len(w.identities)) w.remove_identity("123") print(len(w.identities))
def test_remove_identity(self): test_id = "test_ont_id" w = WalletData(default_id=test_id) size = 10 id_list = list() for i in range(size): rand_id = random.randint(0, 1000000000) identity = Identity(ont_id=rand_id) w.add_identity(identity) id_list.append(rand_id) self.assertEqual(len(w.get_identities()), i + 1) for i in range(size): rand_id = random.choice(id_list) w.remove_identity(rand_id) id_list.remove(rand_id) self.assertEqual(len(w.get_identities()), size - i - 1)
def test_remove_identity(self): test_id = "test_ont_id" wallet = WalletData(default_id=test_id) size = 10 id_list = list() for i in range(size): try: rand_id = str(randint(0, 1000000000)) Identity(ont_id=rand_id) except SDKException as e: self.assertTrue(isinstance(e, SDKException)) rand_id = DID_ONT + str(randint(0, 1000000000)) identity = Identity(ont_id=rand_id) wallet.add_identity(identity) id_list.append(rand_id) self.assertEqual(len(wallet.get_identities()), i + 1) for i in range(size): rand_id = choice(id_list) wallet.remove_identity(rand_id) id_list.remove(rand_id) self.assertEqual(len(wallet.get_identities()), size - i - 1)