summaryrefslogtreecommitdiff
path: root/passlib/tests
Commit message (Collapse)AuthorAgeFilesLines
* Merge from stableEli Collins2020-10-083-249/+527
|\ | | | | | | | | | | | | As part of merge: * various: reverted the py26 compat fixes from rev 5e2f92012412 * test utils: stripped out "has_real_subtest" compat from rev c732a9e2a582, since now on py35+, which always has .subTest() method
| * passlib.ext.django: refactored tests to give more granular results.Eli Collins2020-10-072-200/+424
| | | | | | | | | | | | | | | | | | | | | | | | * refactored DjangoBehaviorTest so instead of a monolothic "test_config()" method; there are now a bunch of different test methods. additionally, the ones with loops now use TestCase.subTest() to parameter things appropriately. *no changes to logic of the tests* * added TestCase.subTest() stub & wrapper to make debugging subtests easier. * added some documentation to test classes.
| * passlib.ext.django: Updated UTs to work with latest django releaseEli Collins2020-10-071-34/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (should fix long-standing issue 98) * test_ext_django: - Simplified "stock config" setup code. It now gets it's "sha_rounds" value from the django source, so we don't have to manually update it every time django changes their default. This should require less maintenance across minor django releases. (Should fix issue 98, and prevent recurrence) - Updated tests to account for quirks in how encoded hashes are handled. Specifically: None, "", and invalid hashes all cause subtly different behaviors across django versions. tests pass against django 1.8 - 3.1. - split "empty hash" test out from the loop it shared with "null hash" test, since the two behave differently. * tox: expanded envlist to explicitly test a bunch more django versions (1.8 - 3.1); and remove some needless "django 2.x + py2" tests * passlib.apps: reformatted django CryptContext declarations; added one for django 2.1 (which dropped "django_bcrypt" it's default list) * passlib.ext.django: - added internal "quirks" helper as central place to track minor edge-case changes between django versions. - passlib_to_django() helper now falls back to searching hasher classes directly, even if patch isn't installed. this allows it to work for django hashers that have been removed from django's default list.
| * bugfix: passlib.tests: revert filtering PasslibSecurityWarning in general;Eli Collins2020-10-071-1/+2
| | | | | | | | | | | | some tests depend on seeing it. (reverts change from rev be9a9121d5a7)
| * passlib.context: now raises UnknownHashError() if hash can't be identified.Eli Collins2020-10-071-21/+11
| | | | | | | | this inherits from ValueError, and has same text, so backwards compatible.
* | python compat cleanup -- replace stray ".im_func" refsEli Collins2020-10-061-4/+7
| |
* | python compat cleanup -- use magic super() callsEli Collins2020-10-0618-43/+42
| |
* | passlib.hash.bcrypt: remove support for "py-bcrypt" backendEli Collins2020-10-061-36/+0
| |
* | passlib.hash.bcrypt: remove support for "bcryptor" backendEli Collins2020-10-062-26/+2
| |
* | cleanup old python compat - assorted minor cleanups & fixes from conversionEli Collins2020-10-065-9/+11
| |
* | cleanup old python compat -- removed str_to_usascii() wrapperEli Collins2020-10-062-6/+6
| |
* | cleanup old python compat -- removed uascii_to_str() wrapperEli Collins2020-10-061-3/+2
| |
* | cleanup old python compat -- replaced "unicode" alias in favor of "str"Eli Collins2020-10-066-32/+29
| |
* | cleanup old python compat -- removed IO aliases (BytesIO etc)Eli Collins2020-10-061-1/+2
| |
* | cleanup old python compat -- removed suppress_cause() and error_from() wrappersEli Collins2020-10-061-5/+2
| |
* | cleanup old python compat -- removed get_unbound_method_function() wrapperEli Collins2020-10-061-2/+1
| |
* | cleanup old python compat -- removed iteritems() wrapperEli Collins2020-10-062-4/+4
| |
* | cleanup old python compat -- removed irange() aliasEli Collins2020-10-066-20/+17
| |
* | cleanup old python compat -- removed some sys.version_info refsEli Collins2020-10-061-16/+6
| |
* | cleanup old python compat -- removed PY2 & PY3 conditionalsEli Collins2020-10-067-99/+38
| |
* | cleanup old python compat -- removed PY26 conditional, and unittest2 imports.Eli Collins2020-10-065-82/+12
| | | | | | | | removing unittest2 also allowed removing "passlib.tests.backports"
* | cleanup old python compat -- removed all "from __future__" importsEli Collins2020-10-0620-20/+0
| |
* | minor cleanups after merge -- removed some stray u() callsEli Collins2020-10-061-2/+2
| |
* | Merge from stableEli Collins2020-10-0610-120/+717
|\ \ | |/
| * passlib.tests: silenced some internal warnings; fixed edge case in scrypt test;Eli Collins2020-10-062-1/+4
| | | | | | | | removed "gae" from tox suite (no meaningful difference from posix tests)
| * passlib.tests.test_ext_django: cleaned up detection of missing django hasher ↵Eli Collins2020-10-064-12/+92
| | | | | | | | | | | | backends; and some related helper methods.
| * passlib.utils: add thread lock to fix some UT failures.Eli Collins2020-10-051-3/+9
| |
| * passlib.hash: added ldap_salted_sha256 & ldap_salted_512 (issue 124)Eli Collins2020-10-051-0/+61
| |
| * passlib.handlers: cases where crypt() returns malformed hashEli Collins2020-10-051-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | now return a single unified InternalBackendError() class, instead of AssertionError. This change has a couple of parts: * assert statements replaced with permanent checks, since crypt() is unpredictable enough that we need to have this always on, even if production runs code in "-O2" mode. * added debug_only_repr() helper which allows including sensitive stuff like salts & hash digests within error tracebacks -- will only do so when global flag is enabled; and that's currently only set by unittest suite. * added new InternalBackendError() exception class (a RuntimeError subclass); which is raised instead of an AssertionError.
| * passlib.tests: silence some warnings, fix some MissingBackendError messagesEli Collins2020-10-034-11/+22
| | | | | | | | | | | | | | | | | | * tests now filter out some passlib deprecation warnings * bugfix: @doesnt_require_backend() decorator (rev XXX) now silences MissingBackendError exceptions thrown during HandlerCase.setUp() * simplified some monkeypatching within test_registry
| * passlib.tests.test_utils: reworked safe_crypt() test to not have hardcodedEli Collins2020-10-031-30/+59
| | | | | | | | des_crypt hashes, for case where OS doesn't have des_crypt support.
| * passlib.tests: updated platform_crypt_support to reflect openbsd changes;Eli Collins2020-10-033-8/+25
| | | | | | | | also cleaned up comments
| * tests: fixed some minor UT errorsEli Collins2020-10-032-5/+6
| | | | | | | | | | mainly a few minor test changes that were missed in prior commits (rev 7273b2ca68f3, 2bf6312ecd77)
| * bugfix: bcrypt os_crypt backend: fix some more crypt.crypt() utf8 encoding ↵Eli Collins2020-05-121-0/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | issues which were causing it to fail to generate a hash. bcrypt ------ * _norm_digest(): fixed some PasslibValueError()s being thrown by os_crypt backend during UT fuzz verifier. These were due to non-UTF8 input being provided to crypt.crypt()... even though secret itself was UTF8 safe! This was because secret was being truncated/repeated as part of various backend bug workarounds; and the truncate/repeat operations weren't being done in manner that respected UTF8 character boundaries. This has now been fixed via _require_valid_utf8_bytes flag (which has been set for os_crypt backend), that enables utf8-safe mode of operation. utils ----- * added utf8_truncate() and utf8_repeat_string() helpers, for bcrypt fixes above. * simplified repeat_string() internals
| * tests / bcrypt: bcrypt_os_crypt_test now strips out non-UTF8 test vectors ↵Eli Collins2020-05-121-2/+7
| | | | | | | | | | | | under py3, since these can't be passed through crypt.crypt()
| * bugfix: bcrypt: test vector for "8bit bug" wasn't UTF8 safe,Eli Collins2020-05-121-0/+7
| | | | | | | | | | | | | | | | | | | | which makes os_crypt backend always fail, since crypt.crypt() can only be made to handle UTF8 byte strings. * replaced "\xA3" test vector with "\xD1\x91" (from same openwall source); since the latter is valid UTF8. * added new test vector to UT suite
| * passlib.tests.utils: simplified OsCryptMixin's "alt hasher" test harness code.Eli Collins2020-05-122-15/+27
| | | | | | | | | | | | | | | | | | removed two config flags (alt_safe_crypt_handler, has_os_crypt_fallback) in favor of making the exceptions just subclass & override the base methods. did this for bcrypt (retaining old functionality), and for bcrypt_sha256 (which fixes spurious errors when running tests on systems w/ os_crypt support, like OpenBSD).
| * passlib.tests: fixed bug where HandlerCase.test_82_crypt_support() wasn'tEli Collins2020-05-112-23/+69
| | | | | | | | | | | | | | | | | | | | | | | | being run on systems where "os_crypt" backend detected as missing. This was because of conflict with create_backend_case(), which marks ALL methods as skipped if backend isn't present. Reworked so certain methods can be marked as "run anyways". In particular, we want platform_crypt_support checks to always run, since they're there as sanity check that our "os_crypt" detection routines are actually working in the first place :) Also rewrote test_82_crypt_support() contents to add some code comments.
| * passlib.crypto.digests: added hardcoded fallback info for common hashes;Eli Collins2020-05-021-0/+5
| | | | | | | | so stats can be gathered retreived even if hash isn't available (e.g. FIPS mode)
| * reworked lookup_hash() and create_hex_digest() internals to work betterEli Collins2020-05-022-3/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on FIPS systems (issue 116). * lookup_hash(): - moved all hash consturctor error checks / handling into HashInfo object, which simplifies lookup_hash() internals - [minor] added "required" kwd, inverse of the now-deprecated "return_unknown" kwd - [minor] now caches unknown/unsupported HashInfo records. * HashInfo: - now catches ValueErrors thrown by hash constructor, and special-cased detection of "disabled for fips" errors. - stub instances now have constructor that throws UnknownHashError, instead of being None. calling code should detect stub instances via the new "not info.supported" instead of testing for "info.const is None". * create_hex_digest() now defaults to creating handlers w/ mock hash func when it's not present (e.g. due to FIPS). this should let them be imported; and defer the errors until they're actually used. * added _set_mock_fips_mode() and some helps to make lookup_hash() fake a FIPS mode system (per traceback provided in issue comments). used this to make some preliminary UTs for the digest & hasher changes above.
| * passlib.crypto.digests: cleaned up internal digests table;Eli Collins2020-05-021-2/+4
| | | | | | | | | | removing some aliases that weren't needed anymore, and adding some new ones.
| * passlib.hash.bcrypt_sha256: now uses hmac-sha256 instead of plain sha256Eli Collins2020-02-161-8/+126
| | | | | | | | (fixes issue 114)
| * passlib.hash.bcrypt: added notes re: final salt characterEli Collins2020-02-171-1/+3
| |
* | Merge from stableEli Collins2019-11-224-16/+28
|\ \ | |/
| * general: Python 2.6 & 3.3 support deprecated -- added notes in docsEli Collins2019-11-221-1/+1
| |
| * tests: django compat fixesEli Collins2019-11-192-14/+12
| | | | | | | | | | | | | | | | | | | | * test_ext_django: account for django 1.11 pbkdf2 defaults * test_handlers_django: looks like django 2 and forward don't expect w passwords-as-bytes at all, so test suites's "bytes -> str" special case is now the default / only policy. * test_handlers_django: django_bcrypt no longer enabled by default as of django 2.2
| * passlib.utils.handlers: split _sanitize() helper out as separate ↵Eli Collins2019-11-121-1/+15
| | | | | | | | | | | | mask_value() function; adjusted UTs
| * argon2, parsehash tests -- fix some PY2 edge cases detected by CIEli Collins2019-11-111-0/+6
| |
* | argon2, parsehash tests -- fix some PY2 edge cases detected by CIEli Collins2019-11-111-0/+6
| |
* | Merge from stableEli Collins2019-11-115-14/+172
|\ \ | |/