示例#1
0
    def test_event(self, gpg_mock, mocker):
        gpg_mock._gpg.verify.return_value = self.mock_response(mocker)
        subscription = util.subscribe_event(self.event_class)

        GPG.verify(gpg_mock, self.signed)
        event = subscription()

        assert isinstance(event.gpg, GPG)
        assert isinstance(event.result, self.response_class)
示例#2
0
    def test_failure_raises_exception(self, gpg_mock, mocker):
        gpg_mock._gpg.verify.return_value = self.mock_response(
            mocker,
            status="signature invalid",
            valid=False,
            stderr="error output",
            pubkey_fingerprint=None,
        )

        with pytest.raises(exceptions.MessageVerifyError):
            GPG.verify(gpg_mock, self.signed)
示例#3
0
 def test_verify_signed_message(self, gpg_mock, mocker):
     gpg_mock._gpg.verify.return_value = self.mock_response(mocker)
     result = GPG.verify(gpg_mock, self.signed, event=False)
     assert result is True