class documentation

class PyNaClKeyTests(KeyTests): (source)

View In Hierarchy

Key tests, but forcing the use of PyNaCl.

Method setUp Undocumented
Method test_naclPrivateBytes _keys_pynacl.Ed25519PrivateKey.private_bytes and _keys_pynacl.Ed25519PrivateKey.from_private_bytes round-trip.
Method test_naclPrivateBytesInvalidParameters _keys_pynacl.Ed25519PrivateKey.private_bytes only accepts certain parameters.
Method test_naclPrivateEquality _keys_pynacl.Ed25519PrivateKey implements equality test methods.
Method test_naclPrivateHash _keys_pynacl.Ed25519PrivateKey.__hash__ allows instances to be hashed.
Method test_naclPublicBytes _keys_pynacl.Ed25519PublicKey.public_bytes and _keys_pynacl.Ed25519PublicKey.from_public_bytes round-trip.
Method test_naclPublicBytesInvalidParameters _keys_pynacl.Ed25519PublicKey.public_bytes only accepts certain parameters.
Method test_naclPublicEquality _keys_pynacl.Ed25519PublicKey implements equality test methods.
Method test_naclPublicHash _keys_pynacl.Ed25519PublicKey.__hash__ allows instances to be hashed.
Method test_naclVerify _keys_pynacl.Ed25519PublicKey.verify raises appropriate exceptions.
Class Variable skip Undocumented

Inherited from KeyTests:

Method tearDown Undocumented
Method test__guessStringType Test that the _guessStringType method guesses string types correctly.
Method test_blobDSA Return the over-the-wire SSH format of the DSA public key.
Method test_blobEC Return the over-the-wire SSH format of the EC public key.
Method test_blobEd25519 Return the over-the-wire SSH format of the Ed25519 public key.
Method test_blobNoKey RuntimeError is raised when the blob is requested for a Key which is not wrapping anything.
Method test_blobRSA Return the over-the-wire SSH format of the RSA public key.
Method test_dataError The keys.Key.data method raises RuntimeError for bad keys.
Method test_equal Test that Key objects are compared correctly.
Method test_fingerprint_md5_hex No summary
Method test_fingerprintBadFormat A BadFingerPrintFormat error is raised when unsupported formats are requested.
Method test_fingerprintdefault No summary
Method test_fingerprintsha256 No summary
Method test_fromAgentv3 Test that keys are correctly generated from Agent v3 strings.
Method test_fromBlobDSA A public DSA key is correctly generated from a public key blob.
Method test_fromBlobECDSA Key.fromString generates ECDSA keys from blobs.
Method test_fromBlobEd25519 A public Ed25519 key is correctly generated from a public key blob.
Method test_fromBlobRSA A public RSA key is correctly generated from a public key blob.
Method test_fromBlobUnsupportedType A BadKeyError error is raised whey the blob has an unsupported key type.
Method test_fromFile Test that fromFile works correctly.
Method test_fromLSHDSA DSA public and private key can be generated from LSHs.
Method test_fromLSHPrivateUnsupportedType BadKeyError exception is raised when private key has an unknown type.
Method test_fromLSHPublicUnsupportedType BadKeyError exception is raised when public key has an unknown type.
Method test_fromLSHRSA RSA public and private keys can be generated from a LSH strings.
Method test_fromNewerOpenSSH Newer versions of OpenSSH generate encrypted keys which have a longer IV than the older versions. These newer keys are also loaded.
Method test_fromOpenSSH Test that keys are correctly generated from OpenSSH strings.
Method test_fromOpenSSH_v1_format OpenSSH 6.5 introduced a newer "openssh-key-v1" private key format (made the default in OpenSSH 7.8). Loading keys in this format produces identical results to loading the same keys in the old PEM-based format.
Method test_fromOpenSSH_windows_line_endings Test that keys are correctly generated from OpenSSH strings with Windows line endings.
Method test_fromOpenSSH_with_whitespace If key strings have trailing whitespace, it should be ignored.
Method test_fromOpenSSHErrors Tests for invalid key types.
Method test_fromPrivateBlobDSA A private DSA key is correctly generated from a private key blob.
Method test_fromPrivateBlobECDSA A private EC key is correctly generated from a private key blob.
Method test_fromPrivateBlobEd25519 A private Ed25519 key is correctly generated from a private key blob.
Method test_fromPrivateBlobRSA A private RSA key is correctly generated from a private key blob.
Method test_fromPrivateBlobUnsupportedType BadKeyError is raised when loading a private blob with an unsupported type.
Method test_fromStringErrors keys.Key.fromString should raise BadKeyError when the key is invalid.
Method test_fromStringNormalizesUnicodePassphrase keys.Key.fromString applies Normalization Form KC to Unicode passphrases.
Method test_init Test that the PublicKey object is initialized correctly.
Method test_isPublic The keys.Key.isPublic method returns True for public keys otherwise False.
Method test_notEqual Test that Key objects are not-compared correctly.
Method test_privateBlobDSA keys.Key.privateBlob returns the SSH protocol-level format of a DSA private key.
Method test_privateBlobEC keys.Key.privateBlob returns the SSH ptotocol-level format of EC private key.
Method test_privateBlobEd25519 keys.Key.privateBlob returns the SSH protocol-level format of an Ed25519 private key.
Method test_privateBlobNoKeyObject Raises RuntimeError if the underlying key object does not exists.
Method test_privateBlobRSA keys.Key.privateBlob returns the SSH protocol-level format of an RSA private key.
Method test_public The keys.Key.public method returns a public key for both public and private keys.
Method test_reprPrivateECDSA The repr of a keys.Key contains all the OpenSSH format for an ECDSA private key.
Method test_reprPrivateEd25519 The repr of a keys.Key contains all the OpenSSH format for an Ed25519 private key.
Method test_reprPrivateRSA The repr of a keys.Key contains all of the RSA components for an RSA private key.
Method test_reprPublicECDSA The repr of a keys.Key contains all the OpenSSH format for an ECDSA public key.
Method test_reprPublicEd25519 The repr of a keys.Key contains all the OpenSSH format for an Ed25519 public key.
Method test_reprPublicRSA The repr of a keys.Key contains all of the RSA components for an RSA public key.
Method test_signAndVerifyDSA Signed data can be verified using DSA.
Method test_signAndVerifyEC Signed data can be verified using EC.
Method test_signAndVerifyEd25519 Signed data can be verified using Ed25519.
Method test_signAndVerifyRSA Signed data can be verified using RSA (with SHA-1, the default).
Method test_signAndVerifyRSASHA256 Signed data can be verified using RSA with SHA-256.
Method test_signAndVerifyRSASHA512 Signed data can be verified using RSA with SHA-512.
Method test_signWithWrongAlgorithm keys.Key.sign raises keys.BadSignatureAlgorithmError when asked to sign with a public key algorithm that doesn't make sense with the given key.
Method test_size The keys.Key.size method returns the size of key object in bits.
Method test_supportedSignatureAlgorithms keys.Key.supportedSignatureAlgorithms returns the appropriate public key signature algorithms for each key type.
Method test_toAgentv3DSA keys.Key.toString serializes a DSA key in Agent v3 format.
Method test_toAgentv3RSA keys.Key.toString serializes an RSA key in Agent v3 format.
Method test_toLSHDSA keys.Key.toString serializes a DSA key in LSH format.
Method test_toLSHRSA keys.Key.toString serializes an RSA key in LSH format.
Method test_toOpenSSHDSA keys.Key.toString serializes a DSA key in OpenSSH format.
Method test_toOpenSSHDSA_v1_format keys.Key.toString serializes a DSA key in OpenSSH's v1 format.
Method test_toOpenSSHECDSA keys.Key.toString serializes an ECDSA key in OpenSSH format.
Method test_toOpenSSHECDSA_v1_format keys.Key.toString serializes an ECDSA key in OpenSSH's v1 format.
Method test_toOpenSSHEd25519 keys.Key.toString serializes an Ed25519 key in OpenSSH's v1 format.
Method test_toOpenSSHEd25519_PEM_format keys.Key.toString refuses to serialize an Ed25519 key in OpenSSH's old PEM format, as no encoding of Ed25519 is defined for that format.
Method test_toOpenSSHRSA keys.Key.toString serializes an RSA key in OpenSSH format.
Method test_toOpenSSHRSA_v1_format keys.Key.toString serializes an RSA key in OpenSSH's v1 format.
Method test_toStringErrors keys.Key.toString raises keys.BadKeyError when passed an invalid format type.
Method test_toStringNormalizesUnicodePassphrase keys.Key.toString applies Normalization Form KC to Unicode passphrases.
Method test_type Test that the type method returns the correct type for an object.
Method test_verifyDSA A known-good DSA signature verifies successfully.
Method test_verifyDSANoPrefix Some commercial SSH servers send DSA keys as 2 20-byte numbers; they are still verified as valid keys.
Method test_verifyRSA A known-good RSA signature verifies successfully.
Instance Variable dsaObj Undocumented
Instance Variable dsaSignature Undocumented
Instance Variable ecObj Undocumented
Instance Variable ecObj384 Undocumented
Instance Variable ecObj521 Undocumented
Instance Variable ed25519Obj Undocumented
Instance Variable keyFile Undocumented
Instance Variable rsaObj Undocumented
Instance Variable rsaSignature Undocumented
Method _testPrivateFromString Undocumented
Method _testPublicFromString Undocumented
Method _testPublicPrivateFromString Undocumented

Inherited from TestCase (via KeyTests):

Method __call__ Run the test. Should always do exactly the same thing as run().
Method __init__ Construct an asynchronous test case for methodName.
Method addCleanup Extend the base cleanup feature with support for cleanup functions which return Deferreds.
Method assertFailure Fail if deferred does not errback with one of expectedFailures. Returns the original Deferred with callbacks added. You will need to return this Deferred from your test case.
Method deferRunCleanups Run any scheduled cleanups and report errors (if any) to the result. object.
Method deferSetUp Undocumented
Method deferTearDown Undocumented
Method deferTestMethod Undocumented
Method getSuppress Undocumented
Method getTimeout Returns the timeout value set on this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a timeout attribute, returns that. Returns util.DEFAULT_TIMEOUT_DURATION...
Instance Variable timeout A real number of seconds. If set, the test will raise an error if it takes longer than timeout seconds. If not set, util.DEFAULT_TIMEOUT_DURATION is used.
Method _cbDeferTestMethod Undocumented
Method _classCleanUp Undocumented
Method _cleanUp Undocumented
Method _deprecateReactor Deprecate iterate, crash and stop on reactor. That is, each method is wrapped in a function that issues a deprecation warning, then calls the original.
Method _ebDeferSetUp Undocumented
Method _ebDeferTearDown Undocumented
Method _ebDeferTestMethod Undocumented
Method _makeReactorMethod Create a method which wraps the reactor method name. The new method issues a deprecation warning and calls the original.
Method _run Run a single method, either a test method or fixture.
Method _runFixturesAndTest Really run setUp, the test method, and tearDown. Any of these may return defer.Deferreds. After they complete, do some reactor cleanup.
Method _undeprecateReactor Restore the deprecated reactor methods. Undoes what _deprecateReactor did.
Method _wait Take a Deferred that only ever callbacks. Block until it happens.
Instance Variable _passed Undocumented
Instance Variable _reactorMethods Undocumented
Instance Variable _timedOut Undocumented

Inherited from SynchronousTestCase (via KeyTests, TestCase):

Method __eq__ Override the comparison defined by the base TestCase which considers instances of the same class with the same _testMethodName to be equal. Since trial puts TestCase instances into a set, that definition of comparison makes it impossible to run the same test method twice...
Method __hash__ Undocumented
Method callDeprecated Call a function that should have been deprecated at a specific version and in favor of a specific alternative, and assert that it was thusly deprecated.
Method flushLoggedErrors Remove stored errors received from the log.
Method flushWarnings Remove stored warnings from the list of captured warnings and return them.
Method getDeprecatedModuleAttribute Retrieve a module attribute which should have been deprecated, and assert that we saw the appropriate deprecation warning.
Method getSkip Return the skip reason set on this test, if any is set. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a skip attribute, returns that in a tuple (...
Method getTodo Return a Todo object if the test is marked todo. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a todo attribute, returns that. Returns ...
Method mktemp Create a new path name which can be used for a new file or directory.
Method patch Monkey patch an object for the duration of the test.
Method run Run the test case, storing the results in result.
Method runTest If no methodName argument is passed to the constructor, run will treat this method as the thing with the actual test inside.
Method shortDescription Undocumented
Instance Variable failureException An exception class, defaulting to FailTest. If the test method raises this exception, it will be reported as a failure, rather than an exception. All of the assertion methods raise this if the assertion fails.
Instance Variable suppress None or a list of tuples of (args, kwargs) to be passed to warnings.filterwarnings. Use these to suppress warnings raised in a test. Useful for testing deprecated code. See also util.suppress.
Instance Variable todo None, a string or a tuple of (errors, reason) where errors is either an exception class or an iterable of exception classes, and reason is a string. See Todo or makeTodo for more information.
Method _getSkipReason Return the reason to use for skipping a test method.
Method _getSuppress Returns any warning suppressions set for this test. Checks on the instance first, then the class, then the module, then packages. As soon as it finds something with a suppress attribute, returns that. ...
Method _installObserver Undocumented
Method _removeObserver Undocumented
Method _runCleanups Synchronously run any cleanups which have been added.
Instance Variable _cleanups Undocumented
Instance Variable _observer Undocumented
Instance Variable _parents Undocumented
Instance Variable _testMethodName Undocumented
Instance Variable _warnings Undocumented

Inherited from _Assertions (via KeyTests, TestCase, SynchronousTestCase):

Method assertAlmostEqual Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Method assertApproximates Fail if first - second > tolerance
Method assertEqual Fail the test if first and second are not equal.
Method assertFalse Fail the test if condition evaluates to True.
Method assertIn Fail the test if containee is not found in container.
Method assertIs Fail the test if first is not second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertIsInstance Fail if instance is not an instance of the given class or of one of the given classes.
Method assertIsNot Fail the test if first is second. This is an obect-identity-equality test, not an object equality (i.e. __eq__) test.
Method assertNoResult Assert that deferred does not have a result at this point.
Method assertNotAlmostEqual Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero.
Method assertNotEqual Fail the test if first == second.
Method assertNotIn Fail the test if containee is found in container.
Method assertNotIsInstance Fail if instance is an instance of the given class or of one of the given classes.
Method assertNotSubstring Fail if astring contains substring.
Method assertRaises Fail the test unless calling the function f with the given args and kwargs raises exception. The failure will report the traceback and call stack of the unexpected exception.
Method assertSubstring Fail if substring does not exist within astring.
Method assertTrue Fail the test if condition evaluates to False.
Method assertWarns Fail if the given function doesn't generate the specified warning when called. It calls the function, checks the warning, and forwards the result of the function if everything is fine.
Method fail Absolutely fail the test. Do not pass go, do not collect $200.
Method failureResultOf Return the current failure result of deferred or raise self.failureException.
Method successResultOf Return the current success result of deferred or raise self.failureException.
def test_naclPrivateBytesInvalidParameters(self): (source)

_keys_pynacl.Ed25519PrivateKey.private_bytes only accepts certain parameters.

def test_naclPrivateEquality(self): (source)

_keys_pynacl.Ed25519PrivateKey implements equality test methods.

def test_naclPrivateHash(self): (source)

_keys_pynacl.Ed25519PrivateKey.__hash__ allows instances to be hashed.

def test_naclPublicBytesInvalidParameters(self): (source)

_keys_pynacl.Ed25519PublicKey.public_bytes only accepts certain parameters.

def test_naclPublicEquality(self): (source)

_keys_pynacl.Ed25519PublicKey implements equality test methods.

def test_naclPublicHash(self): (source)

_keys_pynacl.Ed25519PublicKey.__hash__ allows instances to be hashed.

def test_naclVerify(self): (source)

_keys_pynacl.Ed25519PublicKey.verify raises appropriate exceptions.