Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improved coverage with signing #97

Merged
merged 1 commit into from

3 participants

@alex
Owner

No description provided.

@alex
Owner

I think after this there's no more "obvious" coverage missing, it's all handling failures in NaCl itself that I have no idea how to trigger.

@reaperhulk
Owner

Some of those failure scenarios can likely be switched to asserts. Looking at the libsodium source I've seen a few functions that return an int, but it's always zero.

@coveralls

Coverage Status

Coverage increased (+0.95%) when pulling bcfecfa on alex:signing-coverage into b8863b8 on pyca:master.

@reaperhulk reaperhulk merged commit aba4272 into from
@alex alex deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 16, 2014
  1. @alex

    Improved coverage with signing

    alex authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 1 deletion.
  1. +15 −1 tests/test_signing.py
View
16 tests/test_signing.py
@@ -47,10 +47,17 @@ def ed25519_known_answers():
class TestSigningKey:
-
def test_initialize_with_generate(self):
nacl.signing.SigningKey.generate()
+ def test_wrong_length(self):
+ with pytest.raises(ValueError):
+ nacl.signing.SigningKey(b"")
+
+ def test_bytes(self):
+ k = nacl.signing.SigningKey(b"\x00" * nacl.c.crypto_sign_SEEDBYTES)
+ assert bytes(k) == b"\x00" * nacl.c.crypto_sign_SEEDBYTES
+
@pytest.mark.parametrize("seed", [
b"77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a",
])
@@ -80,6 +87,13 @@ def test_message_signing(self, seed, message, signature, expected):
class TestVerifyKey:
+ def test_wrong_length(self):
+ with pytest.raises(ValueError):
+ nacl.signing.VerifyKey(b"")
+
+ def test_bytes(self):
+ k = nacl.signing.VerifyKey(b"\x00" * nacl.c.crypto_sign_PUBLICKEYBYTES)
+ assert bytes(k) == b"\x00" * nacl.c.crypto_sign_PUBLICKEYBYTES
@pytest.mark.parametrize(
("public_key", "signed", "message", "signature"),
Something went wrong with that request. Please try again.