Exemple #1
0
    def test_recovery_device(self):
        self.client.set_mnemonic(self.mnemonic12)
        with self.client:
            self.client.set_expected_responses(
                [proto.ButtonRequest()] + [proto.WordRequest()] * 24 +
                [proto.Success(), proto.Features()])

            device.recover(
                self.client,
                12,
                False,
                False,
                "label",
                "english",
                self.client.mnemonic_callback,
            )

        # This must fail, because device is already initialized
        with pytest.raises(RuntimeError):
            device.recover(
                self.client,
                12,
                False,
                False,
                "label",
                "english",
                self.client.mnemonic_callback,
            )
    def test_recovery_device(self, client):
        client.set_mnemonic(MNEMONIC12)
        with client:
            client.set_expected_responses(
                [proto.ButtonRequest()]
                + [proto.WordRequest()] * 24
                + [proto.Success(), proto.Features()]
            )

            device.recover(
                client, 12, False, False, "label", "english", client.mnemonic_callback
            )

        with pytest.raises(TrezorFailure):
            # This must fail, because device is already initialized
            # Using direct call because `device.reset` has its own check
            client.call(
                proto.RecoveryDevice(
                    word_count=12,
                    passphrase_protection=False,
                    pin_protection=False,
                    label="label",
                    language="english",
                )
            )
Exemple #3
0
    def test_recovery_device(self):
        with self.client:
            self.client.set_mnemonic(self.mnemonic12)
            self.client.set_expected_responses(
                [proto.WordRequest()] * 24 +
                [proto.Success(), proto.Features()])
            self.client.recovery_device(12, False, False, 'label', 'english')

        # This must fail, because device is already initialized
        with pytest.raises(Exception):
            self.client.recovery_device(12, False, False, 'label', 'english')