Improve type safety, unit test coverage, and usage of crypto routines.
Review Request #10509 — Created April 4, 2019 and submitted
This adds and improves the string type checks for the crypto and SSH
functions, ensuring we catch invalid input before hitting a cryptic
error message. It also fixes a couple of compatibility issues with
Python 3, involving division and an improper decode on a Unicode string.
The bulk of the change improves test coverage of these functions,
ensuring that all the types match what we expect. As part of this, the
method used to generate SSH keys for the tests have changed to create
stable keys for testing (so we can ensure that fingerprints don't change
across test runs) and to do so in a way that ensures we only load the
keys on first use, reusing them for any future tests.
Unit tests pass on Python 2.7/Django 1.6 and Python 3.7/Django 1.11
(with other in-progress changes).
E501 line too long (80 > 79 characters)
Fixed a line length issue.
Revision 2 (+546 -144)
Checks run (2 succeeded)