Пример #1
0
    def test_update_password_of_standard_wallet(self):
        wallet_str = '''{"addr_history":{"Xbv3X1eD4PWQ4Fm8yJ32f4shaLnNLKkXLc":[],"XcQFtHuHYnZi2sewUkAJpYU59zQNDAzRyP":[],"XcyHr5KQac62gRra6zR8QSBRFGBrQw3JPn":[],"XdS6ykw3GYehruoCMDL6isKAkQADt91sso":[],"Xe9Vt6NcF1k33P4eBf2sdhP5VdQoM82ra3":[],"XeNc2DCP6pzaht7DAKcGCz2PHd5Lj12iCK":[],"Xew7jYaKqb7c15Fno2T9i8WTSNvm3hRdL2":[],"XhV9qCJ3zPzgbALTBZUNmztsdx2hq5fL4D":[],"XiPDShPTx8q1Y2tcTYZepLqGW9wVCJV67t":[],"XiTzDWc5hUXnReDeF5XT6NEfYMnZmiEhD6":[],"XjFyxpK8chRxk9YJVP2uLc4x9HS72A6PDd":[],"XjftZGtEoJtcyMihTrWRjZrzoezouTEM9D":[],"XjjNH2aENdryvsMhqWD68Gs9MV91GxL38J":[],"XatcXWHv95EHJgJE7hcsvSiwMhyR74t4Mh":[],"XobfXwwNYgYakhEWbP3swAaXcMjtnV7KnJ":[],"XokpWh2CnDYd4L899597czi8gH99sMzMbQ":[],"Xr94GzQPZs9Aj7mm8Fp4Jh458XCVUPw8wx":[],"XrCgX57b8cfRCppFxnX2BweBMjxUXCGFj7":[],"XrPcfCVLCnqRXdES1gcaRUpRAHy7uaUUqj":[],"XsmJHj4DfesHP6oWxC47VXuorb5YdZQftK":[],"XtCpHFPtGR5pcR5ChNsWmT67zTQMHr4u81":[],"Xu68nscwNBVkfHsuLmcxgjqQBf7JWmGLej":[],"XuVoPvFvHauQ5fropq9oe7w1zSgc1FRCM3":[],"XuXL4eBXnJmWPYYTRVYYcNqqzNKZmrTTTV":[],"XwgwoU6SbpKCE6dnfP7j1re5UW4J93vYE9":[],"XySy8SMtS1SRoLzuif72fXwegQQPhDRtgp":[]},"addresses":{"change":["XrPcfCVLCnqRXdES1gcaRUpRAHy7uaUUqj","Xr94GzQPZs9Aj7mm8Fp4Jh458XCVUPw8wx","Xew7jYaKqb7c15Fno2T9i8WTSNvm3hRdL2","XjjNH2aENdryvsMhqWD68Gs9MV91GxL38J","XjftZGtEoJtcyMihTrWRjZrzoezouTEM9D","XtCpHFPtGR5pcR5ChNsWmT67zTQMHr4u81"],"receiving":["XeNc2DCP6pzaht7DAKcGCz2PHd5Lj12iCK","XcyHr5KQac62gRra6zR8QSBRFGBrQw3JPn","XjFyxpK8chRxk9YJVP2uLc4x9HS72A6PDd","XsmJHj4DfesHP6oWxC47VXuorb5YdZQftK","XySy8SMtS1SRoLzuif72fXwegQQPhDRtgp","XdS6ykw3GYehruoCMDL6isKAkQADt91sso","Xu68nscwNBVkfHsuLmcxgjqQBf7JWmGLej","Xbv3X1eD4PWQ4Fm8yJ32f4shaLnNLKkXLc","XcQFtHuHYnZi2sewUkAJpYU59zQNDAzRyP","Xe9Vt6NcF1k33P4eBf2sdhP5VdQoM82ra3","XuXL4eBXnJmWPYYTRVYYcNqqzNKZmrTTTV","XhV9qCJ3zPzgbALTBZUNmztsdx2hq5fL4D","XokpWh2CnDYd4L899597czi8gH99sMzMbQ","XiPDShPTx8q1Y2tcTYZepLqGW9wVCJV67t","XuVoPvFvHauQ5fropq9oe7w1zSgc1FRCM3","XiTzDWc5hUXnReDeF5XT6NEfYMnZmiEhD6","XatcXWHv95EHJgJE7hcsvSiwMhyR74t4Mh","XobfXwwNYgYakhEWbP3swAaXcMjtnV7KnJ","XrCgX57b8cfRCppFxnX2BweBMjxUXCGFj7","XwgwoU6SbpKCE6dnfP7j1re5UW4J93vYE9"]},"keystore":{"seed":"cereal wise two govern top pet frog nut rule sketch bundle logic","type":"bip32","xprv":"xprv9s21ZrQH143K29XjRjUs6MnDB9wXjXbJP2kG1fnRk8zjdDYWqVkQYUqaDtgZp5zPSrH5PZQJs8sU25HrUgT1WdgsPU8GbifKurtMYg37d4v","xpub":"xpub661MyMwAqRbcEdcCXm1sTViwjBn28zK9kFfrp4C3JUXiW1sfP34f6HA45B9yr7EH5XGzWuTfMTdqpt9XPrVQVUdgiYb5NW9m8ij1FSZgGBF"},"pruned_txo":{},"seed_type":"standard","seed_version":13,"stored_height":-1,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[619,310,840,405]}'''
        db = WalletDB(wallet_str, manual_upgrades=False)
        storage = WalletStorage(self.wallet_path)
        wallet = Wallet(db, storage, config=self.config)

        wallet.check_password(None)

        wallet.update_password(None, "1234")
        with self.assertRaises(InvalidPassword):
            wallet.check_password(None)
        with self.assertRaises(InvalidPassword):
            wallet.check_password("wrong password")
        wallet.check_password("1234")
Пример #2
0
    def test_update_password_of_imported_wallet(self):
        wallet_str = '{"addr_history":{"Xcmu97gPDoJn6NELShGPRnaRDvbLWyN4ph":[],"Xetp3vzZd25tqMTHUs826okUcpnxAtG73J":[],"XpeViGqbFaUYUQYHeYx62tSBNfrctAu6er":[]},"addresses":{"change":[],"receiving":["Xcmu97gPDoJn6NELShGPRnaRDvbLWyN4ph","XpeViGqbFaUYUQYHeYx62tSBNfrctAu6er","Xetp3vzZd25tqMTHUs826okUcpnxAtG73J"]},"keystore":{"keypairs":{"0344b1588589958b0bcab03435061539e9bcf54677c104904044e4f8901f4ebdf5":"XGw9fNSxGB9e7c9G1wHwMdVsfgvLZGxrUVDEiuozYtEJbQQ8Djc9","0389508c13999d08ffae0f434a085f4185922d64765c0bff2f66e36ad7f745cc5f":"XHLdYVniEEZajZEreWmi6AwfqgzjJwKDAyZATAjVavZZ58gdjf38","04575f52b82f159fa649d2a4c353eb7435f30206f0a6cb9674fbd659f45082c37d559ffd19bea9c0d3b7dcc07a7b79f4cffb76026d5d4dff35341efe99056e22d2":"7ri5P9aS73pjQp62MU6MdhNz2cp6XamakdXtp91aRLEJUtZLd1M"},"type":"imported"},"pruned_txo":{},"seed_version":13,"stored_height":-1,"transactions":{},"tx_fees":{},"txi":{},"txo":{},"use_encryption":false,"verified_tx3":{},"wallet_type":"standard","winpos-qt":[100,100,840,405]}'
        db = WalletDB(wallet_str, manual_upgrades=False)
        storage = WalletStorage(self.wallet_path)
        wallet = Wallet(db, storage, config=self.config)

        wallet.check_password(None)

        wallet.update_password(None, "1234")

        with self.assertRaises(InvalidPassword):
            wallet.check_password(None)
        with self.assertRaises(InvalidPassword):
            wallet.check_password("wrong password")
        wallet.check_password("1234")