async def test_postgres_wallet_works(self): """ Ensure that postgres wallet operations work (create and open wallet, create did, drop wallet) """ load_postgres_plugin() postgres_wallet = IndyWallet({ "auto_create": False, "auto_remove": False, "name": "test_pg_wallet", "key": "my_postgres", "storage_type": "postgres_storage", "storage_config": '{"url":"host.docker.internal:5432"}', "storage_creds": '{"account":"postgres","password":"******","admin_account":"postgres","admin_password":"******"}' }) await postgres_wallet.create() await postgres_wallet.open() await postgres_wallet.create_local_did(self.test_seed) py_packed = await postgres_wallet.pack_message(self.test_message, [self.test_verkey], self.test_verkey) await postgres_wallet.close() await postgres_wallet.remove()
async def store(): wallet = IndyWallet( {"auto_create": True, "auto_remove": True, "name": "test-wallet"} ) await wallet.open() yield IndyStorage(wallet) await wallet.close()
async def wallet(): wallet = IndyWallet({ "auto_create": True, "auto_remove": True, "name": "test-wallet" }) await wallet.open() yield wallet await wallet.close()
async def test_postgres_wallet_storage_works(self): """ Ensure that postgres wallet operations work (create and open wallet, store and search, drop wallet) """ load_postgres_plugin() postgres_wallet = IndyWallet({ "auto_create": False, "auto_remove": False, "name": "test_pg_wallet", "key": "my_postgres", "storage_type": "postgres_storage", "storage_config": '{"url":"host.docker.internal:5432", "max_connections":5}', "storage_creds": '{"account":"postgres","password":"******","admin_account":"postgres","admin_password":"******"}' }) await postgres_wallet.create() await postgres_wallet.open() storage = IndyStorage(postgres_wallet) # add and then fetch a record record = StorageRecord( value= '{"initiator": "self", "invitation_key": "9XgL7Y4TBTJyVJdomT6axZGUFg9npxcrXnRT4CG8fWYg", "state": "invitation", "routing_state": "none", "error_msg": null, "their_label": null, "created_at": "2019-05-14 21:58:24.143260+00:00", "updated_at": "2019-05-14 21:58:24.143260+00:00"}', tags={ 'initiator': 'self', 'invitation_key': '9XgL7Y4TBTJyVJdomT6axZGUFg9npxcrXnRT4CG8fWYg', 'state': 'invitation', 'routing_state': 'none' }, type='connection', id='f96f76ec-0e9b-4f32-8237-f4219e6cf0c7') await storage.add_record(record) g_rec = await storage.get_record(record.type, record.id) # now try search search = None try: search = storage.search_records('connection') await search.open() records = await search.fetch(10) finally: if search: await search.close() await postgres_wallet.close() await postgres_wallet.remove()