harvard-lil / perma

Indelible links
411 stars 70 forks source link

Convert additional tests to pytest syntax #3438

Closed rebeccacremona closed 7 months ago

rebeccacremona commented 7 months ago

In #3415, I began refactoring our python test suite to:

a) use pytest fixtures powered by factory boy instead of our json fixtures

b) use standard pytest syntax instead of the older unittest-style syntax

This PR continues the effort, picking off some more of the easier-to-convert modules.

The entirety of test_email, test_utils, test_cloudflare_cache, test_celery_tasks, and test_urls are converted to pytest syntax, and are mostly (but not entirely) updated to use pytest fixtures: I kicked the can in a couple places on the more complex ones, figuring they will be easier once we have a richer library of pytest fixtures prepared.

A big chunk of test_models is also converted and switched over to pytest fixtures. There is still lots to do, but I think this PR converted every test that involves Perma Payments. @kilbergr is going to take the lead on coverting the rest of that file, in a series of upcoming PRs πŸ™ πŸ™Œ.

The diffs are, again, hard to read, but: none of the tests are materially changed: all the same assertions are made, etc. The only thing that has been changed is syntax.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (69fb92e) 69.83% compared to head (debdc0b) 70.40%. Report is 3 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #3438 +/- ## =========================================== + Coverage 69.83% 70.40% +0.56% =========================================== Files 52 52 Lines 6661 6788 +127 =========================================== + Hits 4652 4779 +127 Misses 2009 2009 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.