예제 #1
0
 def test_export_private_key_imported(self, mock_write):
     wallet = restore_wallet_from_text(
         'p2pkh:XGx8LpkmLRv9RiMvpYx965BCaQKQbeMVVqgAh7B5SQVdosQiKJ4i p2pkh:XEn9o6oayjsRmoEQwDbvkrWVvjRNqPj3xNskJJPAKraJTrWuutwd',
         path='if_this_exists_mocking_failed_648151893')['wallet']
     cmds = Commands(config=None, wallet=wallet, network=None)
     # single address tests
     with self.assertRaises(Exception):
         cmds.getprivatekeys(
             "asdasd")  # invalid addr, though might raise "not in wallet"
     with self.assertRaises(Exception):
         cmds.getprivatekeys(
             "XdDHzW6aTeuQsraNXeEsPy5gAv1nUz7Y7Q")  # not in wallet
     self.assertEqual(
         "p2pkh:XEn9o6oayjsRmoEQwDbvkrWVvjRNqPj3xNskJJPAKraJTrWuutwd",
         cmds.getprivatekeys("PAcQeW6SqW8S1JpL6f53m9GnT6AeRFndWo"))
     # list of addresses tests
     with self.assertRaises(Exception):
         cmds.getprivatekeys(['PKJNnVq4Lu8iRqSiNtu249TjUX9qELpRmH', 'asd'])
     self.assertEqual([
         'p2pkh:XGx8LpkmLRv9RiMvpYx965BCaQKQbeMVVqgAh7B5SQVdosQiKJ4i',
         'p2pkh:XEn9o6oayjsRmoEQwDbvkrWVvjRNqPj3xNskJJPAKraJTrWuutwd'
     ],
                      cmds.getprivatekeys([
                          'PKJNnVq4Lu8iRqSiNtu249TjUX9qELpRmH',
                          'PAcQeW6SqW8S1JpL6f53m9GnT6AeRFndWo'
                      ]))
예제 #2
0
 def test_export_private_key_deterministic(self, mock_write):
     wallet = restore_wallet_from_text(
         'hint shock chair puzzle shock traffic drastic note dinosaur mention suggest sweet',
         gap_limit=2,
         path='if_this_exists_mocking_failed_648151893')['wallet']
     cmds = Commands(config=None, wallet=wallet, network=None)
     # single address tests
     with self.assertRaises(Exception):
         cmds.getprivatekeys(
             "asdasd")  # invalid addr, though might raise "not in wallet"
     with self.assertRaises(Exception):
         cmds.getprivatekeys(
             "XdDHzW6aTeuQsraNXeEsPy5gAv1nUz7Y7Q")  # not in wallet
     self.assertEqual(
         "p2pkh:XE5VEmWKQRK5N7kQMfw6KqoRp3ExKWgaeCKsxsmDFBxJJBgdQdTH",
         cmds.getprivatekeys("PUfdKh9bDcnCkp5JRo1hCjFnTzPxq77fVk"))
     # list of addresses tests
     with self.assertRaises(Exception):
         cmds.getprivatekeys(['PUfdKh9bDcnCkp5JRo1hCjFnTzPxq77fVk', 'asd'])
     self.assertEqual([
         'p2pkh:XE5VEmWKQRK5N7kQMfw6KqoRp3ExKWgaeCKsxsmDFBxJJBgdQdTH',
         'p2pkh:XGtpLmVGmaRnfvRvd4qxSeE7PqJoi9FUfkgPKD24PeoJsZCh1EXg'
     ],
                      cmds.getprivatekeys([
                          'PUfdKh9bDcnCkp5JRo1hCjFnTzPxq77fVk',
                          'PM8oe78fUSjGUuWFHbn6seYtoG93SynJy1'
                      ]))