def test_write_dictionnary_to_file(self): storage = WalletStorage(self.wallet_path) some_dict = { u"a": u"b", u"c": u"d", u"seed_version": FINAL_SEED_VERSION } for key, value in some_dict.items(): storage.put(key, value) storage.write() contents = "" with open(self.wallet_path, "r") as f: contents = f.read() self.assertEqual(some_dict, json.loads(contents))
def create(self, name, password=None, seed=None): """Create or restore a new wallet""" path = self._wallet_path(name) if exists(path): raise FileExistsError(path) storage = WalletStorage(path) if seed is None: seed = self.make_seed() print("Your wallet generation seed is:\n\"%s\"" % seed) storage.put('keystore', keystore.from_seed(seed, "", False).dump()) storage.put('wallet_type', 'standard') wallet = Wallet(storage) if password is None: password = main.prompt_password( "Password (hit return if you do not wish to encrypt your wallet):" ) wallet.update_password(None, password, True) storage.write()