Skip to content

Conversation

jonasbardino
Copy link
Contributor

@jonasbardino jonasbardino commented Sep 29, 2025

Add more test coverage and clean up some copy/pasted pickle unit test leftovers.

NB: changes one single line of (currently unused) actual code as explained in
d4dbb39
despite the test-only tag.

@jonasbardino jonasbardino self-assigned this Sep 29, 2025
@jonasbardino jonasbardino added the test-only Improvements or additions solely for better test coverage - without functionality changes label Sep 29, 2025
@jonasbardino
Copy link
Contributor Author

jonasbardino commented Sep 29, 2025

The unit tests failing here are were basically fall-out from the bug now addressed through the merge of PR #344 .

@jonasbardino jonasbardino marked this pull request as ready for review September 29, 2025 20:02
@jonasbardino jonasbardino force-pushed the adjust/pwcrypto-unit-test-to-expand-coverage-and-clean-pickle-heritage branch from 7a5fb13 to d4dbb39 Compare October 3, 2025 06:09
@jonasbardino jonasbardino requested a review from a team October 6, 2025 18:12
@jonasbardino jonasbardino added the follow-up pending Pending tasks to follow-up on after close label Oct 9, 2025
@jonasbardino
Copy link
Contributor Author

Marked follow-up to cover remaining polish of a few minor corner cases at outlined in TODO comments in the code. Still, better to get wide coverage in to support the related #347 and polish last bits later.

@jonasbardino jonasbardino requested a review from a team October 9, 2025 02:22
simple hash, hash and digest. Mixes in various policy configurations.
 * make_safe_hash (sha256)
 * valid_login_password
 * make_scramble+check_scramble
 * make_encrypt+make_decrypt for fernet, aesgcm and aesgcm_static
 * make_encrypt output variation for fernet, aesgcm and aesgcm_static
 * make_encrypt+check_encrypt for fernet, aesgcm and aesgcm_static
 * generate/parse/verify_reset_token
…. The

conversion is already explicitly handled in all `make_encrypt` backends where
it's needed and the bytes break the initial `assure_password_strength` call.

Including the fix here as only the new unit test triggers it.
 * clarify that make_hash generates value depending on random seed
 * assure check_hash works despite this variation in hashes depending on seed
 * make sure otherwise valid password reset tokens fail when expired
@jonasbardino jonasbardino force-pushed the adjust/pwcrypto-unit-test-to-expand-coverage-and-clean-pickle-heritage branch from 78c1429 to 22b25d9 Compare October 10, 2025 07:23
@albu-diku
Copy link
Contributor

Marked follow-up to cover remaining polish of a few minor corner cases at outlined in TODO comments in the code. Still, better to get wide coverage in to support the related #347 and polish last bits later.

Better to get improved coverage as you say. Other suggestions can wait :)

@jonasbardino jonasbardino merged commit 446307f into next Oct 10, 2025
6 of 7 checks passed
@jonasbardino jonasbardino deleted the adjust/pwcrypto-unit-test-to-expand-coverage-and-clean-pickle-heritage branch October 10, 2025 15:26
@jonasbardino
Copy link
Contributor Author

Marked follow-up to cover remaining polish of a few minor corner cases at outlined in TODO comments in the code. Still, better to get wide coverage in to support the related #347 and polish last bits later.

Rereading your original reply I noticed that I missed one important point 👍 because I got caught up in the first bit about the basic test of make_hash itself being removed, which was not in fact the case 8-D

I do generally agree that it makes sense to test dependent functions on static output of their dependecy functions (like from make_hash in this example) to differentiate and pinpoint where if/when errors creep in. In many cases it just also has value to test the combination IMO, so I'd rather that we aim for both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follow-up pending Pending tasks to follow-up on after close test-only Improvements or additions solely for better test coverage - without functionality changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants