def test_apply_settings_passphrase(self): self.setup_mnemonic_pin_nopassphrase() assert self.client.features.passphrase_protection is False with self.client: self.client.set_expected_responses( [proto.Success(), proto.Features()]) self.client.apply_settings(use_passphrase=True) assert self.client.features.passphrase_protection is True with self.client: self.client.set_expected_responses( [proto.Success(), proto.Features()]) self.client.apply_settings(use_passphrase=False) assert self.client.features.passphrase_protection is False with self.client: self.client.set_expected_responses( [proto.Success(), proto.Features()]) self.client.apply_settings(use_passphrase=True) assert self.client.features.passphrase_protection is True
def test_apply_settings(self): with self.client: self.setup_mnemonic_nopin_passphrase() self.client.set_expected_responses( [proto.Success(), proto.Features()]) # HideezClient reinitializes device self.client.apply_settings(label='nazdar')
def test_ping_button_protect(self): self.setup_mnemonic_nopin_nopassphrase() with self.client: self.client.set_expected_responses([proto.Success()]) res = self.client.ping('random data', button_protection=True) assert res == 'random data'
def test_ping(self): with self.client: self.setup_mnemonic_nopin_passphrase() self.client.set_expected_responses([ proto.PassphraseRequest(), proto.PassphraseStateRequest(), proto.Success() ]) self.client.ping('msg', True, True, True)
def test_verify_message(self): with self.client: self.setup_mnemonic_nopin_passphrase() self.client.set_expected_responses([proto.Success()]) self.client.verify_message( 'Bitcoin', '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', unhexlify( '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80' ), 'This is an example of a signed message.')
def test_apply_settings(self): self.setup_mnemonic_pin_passphrase() assert self.client.features.label == 'test' with self.client: self.client.set_expected_responses( [proto.Success(), proto.Features()]) self.client.apply_settings(label='new label') assert self.client.features.label == 'new label'
def test_passphrase_protection(self): self.setup_mnemonic_nopin_passphrase() with self.client: self.client.set_expected_responses([ proto.PassphraseRequest(), proto.PassphraseStateRequest(), proto.Success() ]) self._some_protected_call(False, True, True)
def test_load_device(self): with self.client: self.client.set_expected_responses( [proto.Success(), proto.Features()]) self.client.load_device_by_mnemonic('this is mnemonic', '1234', True, 'label', 'english', skip_checksum=True) # This must fail, because device is already initialized with pytest.raises(Exception): self.client.load_device_by_mnemonic('this is mnemonic', '1234', True, 'label', 'english', skip_checksum=True)
def test_wipe_device(self): with self.client: self.setup_mnemonic_nopin_passphrase() self.client.set_expected_responses( [proto.Success(), proto.Features()]) self.client.wipe_device()
def test_ping(self): ping = self.client.call(messages.Ping(message='ahoj!')) assert ping == messages.Success(message='ahoj!')