Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(104) | Call(104) | Derive(0) | Import(0)
src/p/y/python-trezor-HEAD/tests/test_msg_getaddress.py python-trezor(Download)
def test_btc(self): self.setup_mnemonic_nopin_nopassphrase() self.assertEqual(self.client.get_address('Bitcoin', []), '1EfKbQupktEMXf4gujJ9kCFo83k1iMqwqK') self.assertEqual(self.client.get_address('Bitcoin', [1]), '1CK7SJdcb8z9HuvVft3D91HLpLC6KSsGb') self.assertEqual(self.client.get_address('Bitcoin', [0, -1]), '1JVq66pzRBvqaBRFeU9SPVvg3er4ZDgoMs') self.assertEqual(self.client.get_address('Bitcoin', [-9, 0]), '1F4YdQdL9ZQwvcNTuy5mjyQxXkyCfMcP2P') self.assertEqual(self.client.get_address('Bitcoin', [0, 9999999]), '1GS8X3yc7ntzwGw9vXwj9wqmBWZkTFewBV')
src/p/y/python-trezor-HEAD/tests/test_msg_signmessage.py python-trezor(Download)
def test_sign(self): self.setup_mnemonic_nopin_nopassphrase() sig = self.client.sign_message('Bitcoin', [0], "This is an example of a signed message.") self.assertEqual(sig.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e') self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
def test_sign_testnet(self): self.setup_mnemonic_nopin_nopassphrase() sig = self.client.sign_message('Testnet', [0], "This is an example of a signed message.") self.assertEqual(sig.address, 'mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL') self.assertEqual(binascii.hexlify(sig.signature), '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80')
sig_nfkd = self.client.sign_message('Bitcoin', [0], words_nfkd) self.assertEqual(sig_nfkd.address, '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e') self.assertEqual(binascii.hexlify(sig_nfkd.signature), '1fd0ec02ed8da8df23e7fe9e680e7867cc290312fe1c970749d8306ddad1a1eda4e39588e4ec2b6a22dda4ec4f562f06e91129eea9a844a7193812de82d47c496b')
src/p/y/python-trezor-HEAD/tests/test_msg_changepin.py python-trezor(Download)
# Check that the PIN is correct self.assertEqual(self.client.debug.read_pin()[0], self.pin6) def test_change_pin(self):
# Check current PIN value self.assertEqual(self.client.debug.read_pin()[0], self.pin4) # Let's change PIN
# Check that the PIN is correct self.assertEqual(self.client.debug.read_pin()[0], self.pin6) def test_remove_pin(self):
features = self.client.call_raw(proto.Initialize()) self.assertTrue(features.pin_protection) self.assertEqual(self.client.debug.read_pin()[0], self.pin4) if __name__ == '__main__':
src/p/y/python-trezor-HEAD/tests/test_debuglink.py python-trezor(Download)
def test_mnemonic(self): self.setup_mnemonic_nopin_nopassphrase() mnemonic = self.client.debug.read_mnemonic() self.assertEqual(mnemonic, self.mnemonic12)
pin = self.client.debug.read_pin() self.assertEqual(pin[0], '1234') self.assertNotEqual(pin[1], '')
src/p/y/python-trezor-HEAD/tests/test_msg_recoverydevice.py python-trezor(Download)
# 6 expected fake words and all words of mnemonic are used self.assertEqual(fakes, 6) self.assertEqual(mnemonic, [None] * 12) # Mnemonic is the same self.client.init_device() self.assertEqual(self.client.debug.read_mnemonic(), self.mnemonic12)
# 6 expected fake words and all words of mnemonic are used self.assertEqual(fakes, 6) self.assertEqual(mnemonic, [None] * 12)
src/p/y/python-trezor-HEAD/tests/test_msg_getpublickey.py python-trezor(Download)
def test_btc(self): self.setup_mnemonic_nopin_nopassphrase() self.assertEqual(bip32.serialize(self.client.get_public_node([]), 0x0488B21E), 'xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy') self.assertEqual(bip32.serialize(self.client.get_public_node([1]), 0x0488B21E), 'xpub68zNxjsTrV8y9AadThLW7dTAqEpZ7xBLFSyJ3X9pjTv6Njg6kxgjXJkzxq8u3ttnjBw1jupQHMP3gpGZzZqd1eh5S4GjkaMhPR18vMyUi8N') self.assertEqual(bip32.serialize(self.client.get_public_node([0, -1]), 0x0488B21E), 'xpub6A3FoZqYXj1AbW4thRwBh26YwZWbmoyjTaZwwxJjY1oKUpefLepL3RFS9DHKQrjAfxDrzDepYMDZPqXN6upQm3bHQ9xaXD5a3mqni3goF4v') self.assertEqual(bip32.serialize(self.client.get_public_node([-9, 0]), 0x0488B21E), 'xpub6A2h5mzLDfYginoD7q7wCWbq18wTbN9gducRr2w5NRTwdLeoT3cJSwefFqW7uXTpVFGtpUyDMBNYs3DNvvXx6NPjF9YEbUQrtxFSWnPtVrv') self.assertEqual(bip32.serialize(self.client.get_public_node([0, 9999999]), 0x0488B21E), 'xpub6A3FoZqQEK6iwLZ4HFkqSo5fb35BH4bpjC4SPZ63prfLdGYPwYxEuC6o91bUvFFdMzKWe5rs3axHRUjxJaSvBnKKFtnfLwDACRxPxabsv2r')
src/p/y/python-trezor-HEAD/tests/test_msg_loaddevice.py python-trezor(Download)
def test_load_device_1(self): self.setup_mnemonic_nopin_nopassphrase() mnemonic = self.client.debug.read_mnemonic() self.assertEqual(mnemonic, self.mnemonic12) pin = self.client.debug.read_pin()[0] self.assertEqual(pin, '')
passphrase_protection = self.client.debug.read_passphrase_protection() self.assertEqual(passphrase_protection, False) def test_load_device_2(self): self.setup_mnemonic_pin_passphrase() mnemonic = self.client.debug.read_mnemonic() self.assertEqual(mnemonic, self.mnemonic12)
pin = self.client.debug.read_pin()[0] self.assertEqual(pin, self.pin4) passphrase_protection = self.client.debug.read_passphrase_protection()
src/p/y/python-trezor-HEAD/tests/test_msg_wipedevice.py python-trezor(Download)
def test_wipe_device(self): self.setup_mnemonic_pin_passphrase() features = self.client.call_raw(proto.Initialize()) self.assertEqual(features.initialized, True) self.assertEqual(features.pin_protection, True) self.assertEqual(features.passphrase_protection, True)
features = self.client.call_raw(proto.Initialize()) self.assertEqual(features.initialized, False) self.assertEqual(features.pin_protection, False) self.assertEqual(features.passphrase_protection, False)
src/p/y/python-trezor-HEAD/tests/test_protect_call.py python-trezor(Download)
pin_protection=pin, passphrase_protection=passphrase) self.assertEqual(res, 'random data') def test_expected_responses(self):
def test_no_protection(self): self.setup_mnemonic_nopin_nopassphrase() with self.client: self.assertEqual(self.client.debug.read_pin()[0], '')
def test_pin(self): self.setup_mnemonic_pin_passphrase() with self.client: self.assertEqual(self.client.debug.read_pin()[0], self.pin4)
src/p/y/python-trezor-HEAD/tests/test_msg_resetdevice.py python-trezor(Download)
# Compare that device generated proper mnemonic for given entropies self.assertEqual(mnemonic, expected_mnemonic) mnemonic = []
# Compare that second pass printed out the same mnemonic once again self.assertEqual(mnemonic, expected_mnemonic) # Check if device is properly initialized
# Compare that device generated proper mnemonic for given entropies self.assertEqual(mnemonic, expected_mnemonic) mnemonic = []
# Compare that second pass printed out the same mnemonic once again self.assertEqual(mnemonic, expected_mnemonic) # Check if device is properly initialized
1 | 2 Next