def test_calls_verify_signature(self, mock_verify): entity = DiasporaComment() entity._sender_key = "key" entity._source_object = "<obj></obj>" entity.signature = "sig" mock_verify.return_value = False with pytest.raises(SignatureVerificationError): entity._validate_signatures() mock_verify.reset_mock() mock_verify.return_value = True entity._validate_signatures()
def test_raises_if_no_sender_key(self): entity = DiasporaComment() with pytest.raises(SignatureVerificationError): entity._validate_signatures()