Skip to content

Commit

Permalink
Merge pull request #435 from dajiaji/fix-test-to-align-with-cryptogra…
Browse files Browse the repository at this point in the history
…phy-44

Fix test to align with updates in cryptography version 44.
  • Loading branch information
dajiaji authored Nov 28, 2024
2 parents 9284618 + 47e42d8 commit a7c6e64
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit a7c6e64

Please sign in to comment.