diff --git a/tests/test_v3.py b/tests/test_v3.py index 16161c1..6aff2b5 100644 --- a/tests/test_v3.py +++ b/tests/test_v3.py @@ -204,11 +204,11 @@ def test_v3_public_from_public_bytes_with_invalid_args(self): assert "Invalid bytes for the key." in str(err.value) def test_v3_public_sign_via_encode_with_invalid_key(self): - k = Key.from_paserk( - "k3.secret-pw.mXsR2qVqmcDxmSWeQCnCwNeIxe5RDQ3ehnQvdXFj-YgAAAPoFI8eRXCL8PFpVW_CWOvGHnvMPy0BkMlKF1AtmBYGKold9i-ALC2oflkemYdbncrHbiKGd8zfjTQu2tTo2ayOMHybk_-hhopwJ2IUallYfLfUzPuqvtOQfVxXLtUBPnmR75dhRiPDgzdIO1OMbqa3Z1LDevvzbrcPyhHqmJSZioeJ7j1Mu8DJOvrIK0pWHmjDq_eg4YFnaOgz7I3Tkxx89A", - password="correct horse battery staple".encode("utf-8").hex(), - ) - with pytest.raises(SignError) as err: + with pytest.raises((ValueError, SignError)) as err: + k = Key.from_paserk( + "k3.secret-pw.mXsR2qVqmcDxmSWeQCnCwNeIxe5RDQ3ehnQvdXFj-YgAAAPoFI8eRXCL8PFpVW_CWOvGHnvMPy0BkMlKF1AtmBYGKold9i-ALC2oflkemYdbncrHbiKGd8zfjTQu2tTo2ayOMHybk_-hhopwJ2IUallYfLfUzPuqvtOQfVxXLtUBPnmR75dhRiPDgzdIO1OMbqa3Z1LDevvzbrcPyhHqmJSZioeJ7j1Mu8DJOvrIK0pWHmjDq_eg4YFnaOgz7I3Tkxx89A", + password="correct horse battery staple".encode("utf-8").hex(), + ) pyseto.encode(k, b"Hello world!") pytest.fail("pyseto.sign() should fail.") - assert "Failed to sign." in str(err.value) + assert "Failed to sign" or "Invalid EC Key" in str(err.value)