コード例 #1
0
 def test_find(self):
     cm = CardManager(self.__context)
     identity = IdentitiesManager().create_user("alice", "username")
     owner_key = VirgilKey(self.__context, self.__key_pair_alice.private_key)
     card = cm.create(identity, owner_key)
     try:
         cm.publish(card)
         finded = cm.find("alice")
         self.assertIn(card, finded)
     finally:
         try:
             self.__cleanup_cards(card)
         except Exception:
             pass
コード例 #2
0
 def test_find_multiply(self):
     cm = CardManager(self.__context)
     identity_alice = IdentitiesManager().create_user("alice", "username")
     identity_bob = IdentitiesManager().create_user("bob", "username")
     alice_key = VirgilKey(self.__context, self.__key_pair_alice.private_key)
     bob_key = VirgilKey(self.__context, self.__key_pair_bob.private_key)
     alice_card = cm.create(identity_alice, alice_key)
     bob_card = cm.create(identity_bob, bob_key)
     try:
         cm.publish(alice_card)
         cm.publish(bob_card)
         finded = cm.find(["alice", "bob"])
         self.assertIn(alice_card, finded) and self.assertIn(bob_card, finded)
     finally:
         try:
             self.__cleanup_cards(alice_card)
         except Exception:
             pass