def test_publish_imported_card(self):
     identity = IdentitiesManager().create_user("alice", "username")
     owner_key = VirgilKey(self.__context, self.__key_pair_alice.private_key)
     cm = CardManager(self.__context)
     original_card = cm.create(identity, owner_key)
     exported_card = original_card.export()
     card = cm.import_card(exported_card)
     try:
         card.publish()
         self.assertIsInstance(cm.get(original_card.id), VirgilCard)
         self.assertEqual(cm.get(original_card.id).identity, card.identity)
     finally:
         try:
             self.__cleanup_cards(card)
         except Exception:
             pass
 def test_import_card_unpublished_local_without_id(self):
     data = self.__compatibility_data["export_unpublished_local_virgil_card_without_id"]
     cm = CardManager(self.__context)
     imported_card = cm.import_card(data["exported_card"])
     imported_card_id = self.__crypto.calculate_fingerprint(bytearray(imported_card._VirgilCard__card.snapshot)).to_hex
     self.assertEqual(imported_card_id, data["card_id"])
 def test_import_card_published_global(self):
     data = self.__compatibility_data["export_published_global_virgil_card"]
     cm = CardManager(self.__context)
     imported_card = cm.import_card(data["exported_card"])
     self.assertEqual(imported_card, cm.get(data["card_id"]))
 def test_import_card_unpublished_local(self):
     data = self.__compatibility_data["export_unpublished_local_virgil_card"]
     cm = CardManager(self.__context)
     imported_card = cm.import_card(data["exported_card"])
     self.assertEqual(imported_card.id, data["card_id"])